For Opening the File:
Code:
HANDLE hFile;
hFile = CreateFile("MYFILE.TXT", // create MYFILE.TXT
GENERIC_WRITE, // open for writing
0, // do not share
NULL, // no security
CREATE_ALWAYS, // overwrite existing
FILE_ATTRIBUTE_NORMAL | // normal file
FILE_FLAG_OVERLAPPED, // asynchronous I/O
NULL); // no attr. template
if (hFile == INVALID_HANDLE_VALUE)
{
ErrorHandler("Could not open file."); // process error
}
For Getting the file size:
Code:
DWORD dwSize = GetFileSize(
hFile, //Handle to the file whose size is to be returned.
NULL //Pointer to the variable where the high-order word of the file size is returned.
);
if (dwSize != INVALID_FILE_SIZE)
<here display ur requested file's size ( dwSize ) >
For Closing the File:
CloseHandle(hFile);
I think it gives better info. on ur problem!