- UID
- 67989
注册时间2010-5-31
阅读权限20
最后登录1970-1-1
以武会友
TA的每日心情 | 无聊 2023-3-14 13:51 |
---|
签到天数: 31 天 [LV.5]常住居民I
|
- #include <windows.h>
- #include <stdio.h>
- DWORD ListDir(LPSTR szPath)
- {
- WIN32_FIND_DATA ListFile;
- HANDLE hListFile;
- CHAR szFilePath[MAX_PATH];
- SYSTEMTIME stFileTime;
- lstrcpy(szFilePath, szPath);
- lstrcat(szFilePath, "\\*");
- hListFile = FindFirstFile(szFilePath, &ListFile);
- if (hListFile != INVALID_HANDLE_VALUE)
- {
- do
- {
- FileTimeToSystemTime(&ListFile.ftCreationTime, &stFileTime);
- printf("%d-%02d-%02d %02d:%02d\t", stFileTime.wYear, stFileTime.wMonth, stFileTime.wDay, stFileTime.wHour, stFileTime.wMinute);
- if (ListFile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
- {
- printf("<DIR>\t");
- }
- else
- {
- printf("\t%ld", ListFile.nFileSizeHigh * (MAXDWORD + 1) + ListFile.nFileSizeLow);
- }
- printf("\t%s\n", ListFile.cFileName);
- }while (FindNextFile(hListFile, &ListFile));
- }
- return 0;
- }
- int main(int argc, PCHAR argv[])
- {
- if (argc == 2)
- {
- ListDir(argv[1]);
- }
- else
- {
- CHAR szCurPath[MAX_PATH];
- GetCurrentDirectory(MAX_PATH, szCurPath);
- ListDir(szCurPath);
- }
- return 0;
- }
复制代码
|
评分
-
查看全部评分
|