_filelength, _filelengthi64

Gets the length of a file.

long _filelength( 
   int fd 
);
__int64 _filelengthi64( 
   int fd 
);

Parameters

  • fd
    Target the file descriptor.

Return Value

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.

Requirements

Function

Required header

_filelength

<io.h>

_filelengthi64

<io.h>

For more compatibility information, see Compatibility in the Introduction.

Example

See the example for _chsize.

.NET Framework Equivalent

See Also

Reference

File Handling

_chsize

_fileno

_fstat, _fstat32, _fstat64, _fstati64, _fstat32i64, _fstat64i32

_fstat, _fstat32, _fstat64, _fstati64, _fstat32i64, _fstat64i32

_stat, _wstat Functions

_stat, _wstat Functions