-
Jun 5th, 2005, 10:42 PM
#1
Thread Starter
Hyperactive Member
Retrieving a file's modified date/time
I'm using the FindFirstFile and FindNextFile to iterate my way through a directory of files.
So far so good as I have figured out how to ignore the "." and ".." *files*. However, I can't figure out how to get each file's Last-Modified date and time information. I thought I could use FindFileData.ftLastWriteTime which compiles fine but causes the program to crash when I run it. It seems to be accessing the wrong bit of memory.
I also found this, and included the winbase.h header file in my progrect:
BOOL GetFileTime(
HANDLE hFile,
LPFILETIME lpCreationTime,
LPFILETIME lpLastAccessTime,
LPFILETIME lpLastWriteTime
);
But upon compiling I recieve the following compiler error:
Cpp1.cpp(13) : error C2373: 'GetFileTime' : redefinition; different type modifiers
c:\program files\microsoft visual studio\vc98\include\winbase.h(2487) : see declaration of 'GetFileTime'
My declaration appears to be correct in the winbase.h file (I've never modified it)
Can anyone point me in the right direction? Or show me an example of how to get the last-modified date/time if you have the filepath? I cannot find any decent examples on good ole Googles.
VB.NET 2005 Express with .Net 2.0
C# 2010 .Net 4.0
-
Jun 6th, 2005, 03:25 AM
#2
Re: Retrieving a file's modified date/time
Never directly include the Window sub-headers. Include <windows.h>, that should suffice.
All the buzzt
CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|