I have the full name and path of the executable, for example. C:\IW4\BIN\iw32.exe and want to extract the compilation date and time of this executable file.
How can i do this? I did not find a suitable solution.
My C ++ program should compile under Windows using Borland C ++ Builder, if this information is of value.
EDIT: I found a sample code and it works, thanks for all your pointers and tips!
Code:
#include <stdio.h> #include <windows.h> int main (int argc, char** argv) { WIN32_FILE_ATTRIBUTE_DATA attr; SYSTEMTIME creation; if (argc < 2) return 1; GetFileAttributesEx(argv[1], GetFileExInfoStandard, &attr); FileTimeToSystemTime(&attr.ftLastWriteTime, &creation); printf("Created: %04d-%02d-%02d %02d:%02d:%02d\n" "Size: %d bytes\n", creation.wYear, creation.wMonth, creation.wDay, creation.wHour, creation.wMinute, creation.wSecond, attr.nFileSizeLow); return 0; }
Which provides the following conclusion:
Created: 2013-06-20 12:37:14 Size: 15098368
source share