home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
c
/
bplus11.arc
/
FILELEN.C
< prev
next >
Wrap
C/C++ Source or Header
|
1988-12-07
|
663b
|
26 lines
/*****************************************************************
| filelength - returns the length of a file
****************************************************************/
long filelength (fd)
int fd;
{
#if 0 /* original version */
long orig, last, lseek();
orig = lseek (fd, 0L, 1); /* seek to the current position */
last = lseek (fd, 0L, 2); /* seek to the end */
lseek (fd, orig, 0); /* reset the pointer */
return last;
#else /* new network version */
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
struct stat sb;
fstat(fd, &sb);
return sb.st_size;
#endif
}