DWORD GetFileSize( HANDLE hFile, // handle to file
LPDWORD lpFileSizeHigh // high-order word of file size);
BOOL GetFileSizeEx( HANDLE hFile, // handle to file
PLARGE_INTEGER lpFileSize // file size);
DWORD GetCompressedFileSize( LPCTSTR lpFileName, // file name
LPDWORD lpFileSizeHigh // high-order DWORD of file size);
GetFileSize和GetFileSizeEx返回文件逻辑大小,GetCompressedFileSize返回文件在磁盘上占用的直接数
例:一个文件100KB压缩后只占用85k,GetFilesize返回的是文件的逻辑大小100KB,
GetCompressedFileSize返回在磁盘上实际占用的字节数
int _stat( const char *path, struct _stat *buffer );
_stat:获得由path指定的文件或目录的信息,并存储在结构指出缓冲区。 _stat自动处理多字节字符的字符串参数
,根据目前使用的多字节代码页适当认识到多字节字符序列。
struct _stat buf;
int result;
char buffer[] = "A line to output";
/* Get data associated with "stat.c": */
result = _stat( "stat.c", &buf );