Наши проекты:
Журнал · Discuz!ML · Wiki · DRKB · Помощь проекту |
||
ПРАВИЛА | FAQ | Помощь | Поиск | Участники | Календарь | Избранное | RSS |
[18.191.46.36] |
|
Сообщ.
#1
,
|
|
|
Как узнать размер файла в байтах, при этом не читая его?
|
Сообщ.
#2
,
|
|
|
WinAPI: GetFileSize
CRT: fseek( File, 0, SEEK_END); LONG lSize = ftell( File); |
Сообщ.
#3
,
|
|
|
Цитата WinAPI: GetFileSize поподробнее можно(какую билиотеку подключ., какие праметры вводить ...) |
Сообщ.
#4
,
|
|
|
Цитата DWORD GetFileSize( HANDLE hFile, LPDWORD lpFileSizeHigh); Parameters hFile [in] Open handle of the file whose size is being returned. The handle must have been created with either GENERIC_READ or GENERIC_WRITE access to the file. lpFileSizeHigh [out] Pointer to the variable where the high-order word of the file size is returned. This parameter can be NULL if the application does not require the high-order word. Вот пример: Цитата // // Case One: calling the function with // lpFileSizeHigh == NULL // Try to obtain hFile's size dwSize = GetFileSize (hFile, NULL) ; // If we failed ... if (dwSize == 0xFFFFFFFF) { // Obtain the error code. dwError = GetLastError() ; // Deal with that failure. . . . } // End of error handler // // Case Two: calling the function with // lpFileSizeHigh != NULL // Try to obtain hFile's huge size. dwSizeLow = GetFileSize (hFile, & dwSizeHigh) ; // If we failed ... if (dwSizeLow == 0xFFFFFFFF && (dwError = GetLastError()) != NO_ERROR ){ // Deal with that failure. . . . } // End of error handler. |