problem with function "_tfindfirst()"

L

Liang Zhang

HI, ALL
I found a surprising problem when using function "_tfindfirst()" and
"_tfindnext()" to enumerate all the files in a specified directory, the code
is like below:

handle = _tfindfirst(searchdir,&filefind);
if (handle != -1)
{
do
{
// if (_A_SUBDIR != filefind.attrib)// is a jar file
{
_tcscat(destParams, jarPath);
_tcscat(destParams, _TEXT("\\"));
_tcscat(destParams, filefind.name);
_tcscat(destParams, ";");
}
} while (0 ==_tfindnext(handle,&filefind));
}
else
{
LOG("Cannot find the jar files from search path below");
LOG(searchdir);
}
_findclose(handle);

this code piece will be executed twice in my program, and in the first pass,
it works well, however, it fails in the second pass. and the searchdir is
the same one and the target directory is kept intact, i don't know why this
happens, could you have any suggestions?
--

Best Regards

Liang Zhang

Developer
SAP Labs China

T: +86 21 61006699-7775
F: +86 21 65984520
Email (e-mail address removed)

SAP LABS CHINA : INNOVATE THE FUTURE
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top