sky*_*lla 5 c++ executable datetime compilation
我有可执行文件的全名和路径,例如C:\IW4\BIN\iw32.exe,并且想要提取该可执行文件的编译日期和时间.
我怎样才能做到这一点?我找不到合适的解决方案.
我的C++程序必须使用Borland C++ Builder在Windows下编译,如果该信息有任何价值.
编辑:我发现了一些示例代码,它的工作原理,感谢您的所有指示和提示!
守则是:
#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;
}
Run Code Online (Sandbox Code Playgroud)
其中提供以下输出:
Created: 2013-06-20 12:37:14
Size: 15098368
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5417 次 |
| 最近记录: |