1 // some misc. file/disk routines
2 // Arne de Bruijn, 1998
14 //added 05/17/99 Matt Mueller
20 #define lseek(a,b,c) _lseek(a,b,c)
23 long filelength(int fd) {
26 if ((old_pos = lseek(fd, 0, SEEK_CUR)) == -1 ||
27 (size = lseek(fd, 0, SEEK_END)) == -1 ||
28 (lseek(fd, old_pos, SEEK_SET)) == -1)
33 long ffilelength(FILE *fh)
35 return filelength(fileno(fh));
39 unsigned long d_getdiskfree()
55 return cbCluster * cClusters;
63 unsigned long GetDiskFree()
65 return d_getdiskfree();
68 // remove extension from filename, doesn't work with paths.
69 void removeext(const char *filename, char *out) {
71 if ((p = strrchr(filename, '.'))) {
72 strncpy(out, filename, p - filename);
73 out[p - filename] = 0;
75 strcpy(out, filename);