На главную Наши проекты:
Журнал   ·   Discuz!ML   ·   Wiki   ·   DRKB   ·   Помощь проекту
ПРАВИЛА FAQ Помощь Участники Календарь Избранное RSS
msm.ru
Модераторы: Qraizer, Hsilgos
  
> Как узнать размер файла?
    Как узнать размер файла в байтах, при этом не читая его?
      WinAPI: GetFileSize
      CRT: fseek( File, 0, SEEK_END); LONG lSize = ftell( File);
        Цитата
        WinAPI: GetFileSize

        поподробнее можно(какую билиотеку подключ., какие праметры вводить ...)
          Цитата

          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.
          0 пользователей читают эту тему (0 гостей и 0 скрытых пользователей)
          0 пользователей:


          Рейтинг@Mail.ru
          [ Script execution time: 0,0209 ]   [ 16 queries used ]   [ Generated: 3.05.24, 14:32 GMT ]