-
findfirst
im struggling to get findfirst to work in C++ i am using Microsoft Visual C++. Trying to fing all gifs in a directory. I found this following code is the general way of achieving this....
Code:
#include <dos.h>
#include <iostream>
int done;
struct ffblk ffblk;
done = findfirst("*.gif",&ffblk,0);
while(!done){
cout<<ffblk.ff_name;
}
return 0;
}
where am i going wrong? and how can i change directories?
-
-
VC++ compilers, and all other 32-bit compilers, do not suport any of the functions in dos.h. So you might as well delete that line from your program because it won't compile.
To get a list of all the files in a directory, use _findfirst() and _findnext(), or FindFirstFile() and FileNextFile(). see www.msdn.microsoft.com or google for function details.
-