【程序】 #include "stdafx.h" #include <Windows.h>
#define echo(str) WriteConsole(hConsoleOutput, str, _tcslen(str), NULL, NULL) #define echo_t(str) echo(TEXT(str))
int _tmain(int argc, _TCHAR* argv[]) { LPTSTR szFileName = TEXT("D:\\Codes\\PHP\\Arslanbar\\2\\classes\\*t.*"); WIN32_FIND_DATA ffd; HANDLE hFindFile = FindFirstFile(szFileName, &ffd); HANDLE hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE); if (hFindFile == INVALID_HANDLE_VALUE) { echo_t("No file"); } else { do { echo(ffd.cFileName); echo_t("\r\n"); } while (FindNextFile(hFindFile, &ffd)); FindClose(hFindFile); } return 0; }
【输出】 DataObject.php DataObject.php.LCK Request.php ZhSupport.php Press any key to continue . . .
|