Ok, here is my solution:
int DirectoryReader::MakeList(string p_sPath)
{
cout << "Parameter: " << p_sPath << endl;
struct _finddatai64_t struct_filedata;
string s_filename = p_sPath + "\\*.*";
string s_current = ".";
string s_parrent = "..";
cout << "Listing " << s_filename << endl;
long nHandle = _findfirsti64(s_filename.c_str(), &struct_filedata);
if(nHandle >= 0)
{
while(_findnexti64(nHandle, &struct_filedata) == 0)
{
if(struct_filedata.attrib & _A_SUBDIR)
{
if( (s_current.compare(struct_filedata.name) && s_parrent.compare(struct_filedata.name)) )
{
s_filename = p_sPath + "\\" + struct_filedata.name;
cout << "Subdir found: " << s_filename << endl;
MakeList(s_filename);
}
else
{
cout << "Dir found: " << struct_filedata.name << endl;
}
}
else
{
cout << "File found: " << struct_filedata.name << endl;
m_vFilenames.push_back(struct_filedata.name);
}
}
}
else
{
cout << "Path not found." << endl;
return -1;
}
return 1;
}
Two things bother me:
1) strcmp() don't want take data.name as first parameter,
2) "." should be found and displayed, but it isn't.
It works well besides that.
Last edited by Cybulski; May 16th, 2008 at 9:48 am.