hi, can anyone tell me how to search a given directory using C++?
so far i have been successful in searching a file named, for tags"h:\\tags.cpp",
whereas i would like to search for all files in the entire h: directory.
this is the code i have used for searching the file named, "h:\\tags.cpp",
/*char filename[120];
cout<<"Please enter the filename";
cin>>filename;*/
char str[2000];
string stt;
//fstream file_op(filename,ios::in);
fstream file_op("h:\\tags.cpp",ios::in);
if(file_op.is_open())
{
while(!file_op.eof())
{
file_op.getline(str,2000);
cout<<str<<endl;
stt+=str;
}
file_op.close();
cout <<endl;
}
else
cout << "cannot open file" << endl;
im using Dev-CC++ 4.9.9.2 on Win XP Pro
many thanks