I have some .eps files in folder and I would like to read their names using C++. I am using FindFirstFile() and FindNextFile() Win32 API to read file names. My file names are as Sample1.eps, Sample2.eps,....,Sample12.eps. I would like to read all the file names sequentially i.e. from Sample1 to Sample12. My code is reading all file names but they are not in sequence. It reads Sample1.eps first then it reads Sample10.eps instead of Sample2.eps. If I change file names to Sample01.eps, Sample02.eps,..., Sample12.eps. Then my code reads all the file names sequentially.
But I would like to keep my file names as Sample1.eps, Sample2.eps etc. Does anybody help me to solve this problem?
I am attaching my file read code below:
HANDLE handle = FindFirstFile("C:\\eps\\*.eps", &fd);
if(handle == INVALID_HANDLE_VALUE)
cout << "Invalid file handle." << endl;
} while(FindNextFile(handle, &fd));