_filelength、_filelengthi64_filelength, _filelengthi64
ファイルの長さを取得します。Gets the length of a file.
構文Syntax
long _filelength(
int fd
);
__int64 _filelengthi64(
int fd
);
パラメーターParameters
スクリプターfd
ファイル記述子をターゲットにします。Target the file descriptor.
戻り値Return Value
_Filelength と _filelengthi64 はどちらも、 fd に関連付けられているターゲットファイルのファイル長をバイト単位で返します。Both _filelength and _filelengthi64 return the file length, in bytes, of the target file associated with fd. Fd が無効なファイル記述子の場合、この関数は「パラメーターの検証」で説明されているように、無効なパラメーターハンドラーを呼び出します。If fd is an invalid file descriptor, this function invokes the invalid parameter handler, as described in Parameter Validation. 実行の継続が許可された場合、どちらの関数もエラーを示す-1L を返し、 errno を EBADF に設定します。If execution is allowed to continue, both functions return -1L to indicate an error and set errno to EBADF.
解説Remarks
既定では、この関数のグローバル状態はアプリケーションにスコープが設定されています。By default, this function's global state is scoped to the application. これを変更するには、「 CRT でのグローバル状態」を参照してください。To change this, see Global state in the CRT.
要件Requirements
機能Function | 必須ヘッダーRequired header |
---|---|
_filelength_filelength | <io.h> |
_filelengthi64_filelengthi64 | <io.h> |
互換性について詳しくは、「 Compatibility」をご覧ください。For more compatibility information, see Compatibility.
例Example
「_chsize」の例を参照してください。See the example for _chsize.
関連項目See also
ファイルの処理File Handling
_chsize_chsize
_fileno_fileno
_fstat、_fstat32、_fstat64、_fstati64、_fstat32i64、_fstat64i32_fstat, _fstat32, _fstat64, _fstati64, _fstat32i64, _fstat64i32
_stat、_wstat 関数_stat, _wstat Functions