• Advertisement

Archived

This topic is now archived and is closed to further replies.

CreateFile help pleaze

This topic is 5303 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

why am I having problems getting the file handle? HANDLE hfile = CreateFile("C:\\test.txt", GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); FILETIME creationtime; FILETIME lastaccesstime; FILETIME lastwritetime; GetFileTime(&hfile,&creationtime,&lastaccesstime, &lastwritetime); [edited by - 101 on October 16, 2003 8:17:48 PM]

Share this post


Link to post
Share on other sites
Advertisement
What error code do you get from GetLastError()? It will probably make no difference, but dwShareMode and dwFlagsAndAttributes should be 0, not NULL.

A LPFILETIME is only a pointer to a FILETIME, so you need to allocate some memory before using it with GetFileTime, or just:

FILETIME creationtime;
FILETIME lastaccesstime;
FILETIME lastwritetime;

GetFileTime(hfile, &creationtime, &lastaccesstime, &lastwritetime);

Note no address-of on hfile

Share this post


Link to post
Share on other sites
I''m not getting an error, but GetFileTime is returning bad values, which I am assuming is from a bad handle to the file.

Share this post


Link to post
Share on other sites

  • Advertisement