Category : C++ Source Code
Archive   : VCCRT1.ZIP
Filename : FLENGTH.C

 
Output of file : FLENGTH.C contained in archive : VCCRT1.ZIP
/***
*flength.c - find length of a file
*
* Copyright (c) 1985-1992, Microsoft Corporation. All rights reserved.
*
*Purpose:
* defines filelength() - find the length of a file
*
*******************************************************************************/

#include
#include
#include
#include
#include
#include


/***
*long _filelength(filedes) - find length of a file
*
*Purpose:
* Returns the length in bytes of the specified file.
*
*Entry:
* int filedes - handle referring to file to find length of
*
*Exit:
* returns length of file in bytes
* returns -1L if fails
*
*Exceptions:
*
*******************************************************************************/

long _filelength (filedes)
REG1 int filedes;
{
long length;
long here;


#ifdef _QWIN
if (filedes < 0 || filedes >= (_qwinused ? _wnfile : _nfile) )
#else
if (filedes < 0 || filedes >= _nfile)
#endif
{
errno = EBADF;
return(-1);
}


/* Seek to end to get length of file. */
if ( (here = _lseek(filedes,0L,1)) == -1L)
length = -1; /* return error */
else {
length = _lseek(filedes,0L,2);
if (here != length)
_lseek(filedes,here,0);
}


return(length);
}


  3 Responses to “Category : C++ Source Code
Archive   : VCCRT1.ZIP
Filename : FLENGTH.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/