Created
November 13, 2014 10:53
-
-
Save JubbaSmail/ebaf2f1c6bc039fa5550 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <windows.h> | |
| #include <stdio.h> | |
| #if define UNICODE | |
| #define FindFirstFile FindFirstFileW | |
| #define FindNextFile FindNextFileW | |
| #else | |
| #define FindFirstFile FindFirstFileA | |
| #define FindNextFile FindNextFileA | |
| #endif | |
| int main(int argc, LPTSTR argv[]) | |
| { | |
| HANDLE hFind; | |
| WIN32_FIND_DATA FindData; | |
| if (argc != 2) { | |
| fprintf(stderr, "Usage: find pattern\n"); | |
| return 1; | |
| } | |
| // Find the first file | |
| hFind = FindFirstFile(argv[1], &FindData); | |
| printf(strcat(FindData.cFileName, "\n")); | |
| // Look for more | |
| while (FindNextFile(hFind, &FindData)) | |
| { | |
| printf( strcat(FindData.cFileName,"\n") ); | |
| //printf("\n"); | |
| } | |
| // Close the file handle | |
| FindClose(hFind); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment