I am trying to read contents of directory... using "FindNextFile(hFind, &FindFileData)"
Findfirstfile returned me then first file in the directory.. even though I have somany files in the directory (FindNextFile(hFind, &FindFileData) returning me zero.....
Are you sure FindNextFile is the problem here? Because it doesn't look like it.
I have no idea what your _ftime and related stuff is doing. Maybe that's contributing to the problem.
Other things I noticed:
1 2
//if(temp.c_str() == refFileName.c_str()) //BAD
if(temp == refFileName) // GOOD
You can't use the == operator to compare two c-style strings (char arrays). Use it on std strings instead.
Also, was countSeed ever initialized? I don't see it anywhere in that code. If the loop is only running once, my money is that it's because countSeed > noOfInstances.
The only way I can see FindNextFile being the problem is if refFileName is something weird. What is that when FindFirstFile is called?
The file times are in the buffer, FindFileData, in fields ftCreationTime, ftLastAccessTime and ftLastWriteTime. You need to convert the one you're interested in with FileTimeToLocalTime.
@bluecoder, thanks alot for your kind info. and
@Kbw Iam using the buffers just to hold the current time and stop time. before the while loop it is initialized...
Guys problem solved....
It needs some settings to be changed in the properties..
In project properties just change the character set from unicode to multibyte character set....:)