470,594 Members | 1,106 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,594 developers. It's quick & easy.

problem with function "_tfindfirst()"

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 li*********@sap.com

SAP LABS CHINA : INNOVATE THE FUTURE
May 10 '06 #1
1 2921
Liang Zhang wrote:
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:


http://www.parashift.com/c++-faq-lit...t.html#faq-5.9
Jonathan

May 10 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by papigreg | last post: by
21 posts views Thread by Mike | last post: by
5 posts views Thread by dost | last post: by
1 post views Thread by john.swilting | last post: by
3 posts views Thread by ziycon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.