Let me show what I did so that I could actually compile what you posted (since who knows what's in your for loop):
Code:
#include <stdio.h>
#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;
printf("Source Code Line Counter For C/C++\n");
int FileCount = 0;
for(unsigned i = 0;i < NUM_EXTENSIONS;++i)
{
hFind = FindFirstFile(Extensions[i], &FindData);
if (hFind == INVALID_HANDLE_VALUE) {
printf("Invalid handle for %s.\n", Extensions[i]);
}
}
return 0;
}
My root directory has (now, just for you) a .cpp file, but none of the others. I get six lines printed -- one for each extension other than .cpp. Does that work for you?