_filelength, _filelengthi64


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at _filelength, _filelengthi64.

Gets the length of a file.

long _filelength(   
   int fd   
__int64 _filelengthi64(   
   int fd   


Target the file descriptor.

Both _filelength and _filelengthi64 return the file length, in bytes, of the target file associated with fd. If fd is an invalid file descriptor, this function invokes the invalid parameter handler, as described in Parameter Validation. If execution is allowed to continue, both functions return –1L to indicate an error and set errno to EBADF.

FunctionRequired header

For more compatibility information, see Compatibility in the Introduction.

See the example for _chsize.

File Handling
_fstat, _fstat32, _fstat64, _fstati64, _fstat32i64, _fstat64i32
_fstat, _fstat32, _fstat64, _fstati64, _fstat32i64, _fstat64i32
_stat, _wstat Functions
_stat, _wstat Functions