please dont rip this site Prev Next

GetFileSize info  Overview  Group

The GetFileSize function retrieves the size, in bytes, of the specified file.

DWORD GetFileSize(

    HANDLE hFile,

// handle of file to get size of

    LPDWORD lpFileSizeHigh 

// address of high-order word for file size

   );

Parameters

hFile
Specifies an 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
Points 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.

Return Values

If the function succeeds, the return value is the low-order doubleword of the file size, and, if lpFileSizeHigh is non-NULL, the function puts the high-order doubleword of the file size into the variable pointed to by that parameter.

If the function fails and lpFileSizeHigh is NULL, the return value is 0xFFFFFFFF. To get extended error information, call GetLastError.

If the function fails and lpFileSizeHigh is non-NULL, the return value is 0xFFFFFFFF and GetLastError will return a value other than NO_ERROR.

Remarks

You cannot use the GetFileSize function with a handle of a nonseeking device such as a pipe or a communications device. To determine the file type for hFile, use the GetFileType function.

The GetFileSize function obtains the uncompressed size of a file. Use the GetCompressedFileSize function to obtain the compressed size of a file.

Note that if the return value is 0xFFFFFFFF and lpFileSizeHigh is non-NULL, an application must call GetLastError to determine whether the function has succeeded or failed. The following sample code illustrates this point:

// 

// 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. 

 

See Also

GetCompressedFileSize, GetFileType


file: /Techref/os/win/api/win32/func/src/f32.htm, 4KB, , updated: 2000/4/7 11:19, local time: 2024/12/23 09:24,
TOP NEW HELP FIND: 
18.224.54.118:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://massmind.ecomorder.com/Techref/os/win/api/win32/func/src/f32.htm"> GetFileSize</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to ecomorder.com!

 

Welcome to massmind.ecomorder.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .