I'm trying to create a console application that reads all files in a directory, and count the total line count in it with FindFirstFile() but it always returns an INVALID_HANDLE_VALUE.
Can someone help me to solve this problem?
Code:#include <iostream> #include <string> #include <fstream> #include <vector> #include <windows.h> #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif #define NUM_EXTENSIONS 7 const char *Extensions[NUM_EXTENSIONS] = { "\\*.c", "\\*.h", "\\*.cpp", "\\*.cc", "\\*.cxx", "\\*.hh", "\\*.hpp" }; int main(int argc, char *argv[]) { HANDLE hFind; int ErrorCode; WIN32_FIND_DATA FindData; std::vector<std::string> FileList; std::cout << "Source Code Line Counter For C/C++\n"; int FileCount = 0; for(unsigned i = 0;i < NUM_EXTENSIONS;++i) { hFind = FindFirstFile(Extensions[i], &FindData);



LinkBack URL
About LinkBacks



