|
| Re: FindFirst problem with drive letters. |
 |
Sat, 06 Jan 2007 09:52:00 GMT |
kokopelli69@gmail.com wrote:
CUT
> I tried variations of C:\\ vs C: but nothing works.
> I have never had this kind of problem with VB or VC++.
CUT
You try to change:
iResult = FindFirst("D:", faAnyFile, SearchRec);
in
iResult = FindFirst("D:\\*.*", faAnyFile, SearchRec);
You must insert this in loop...
My function:
//------ Retrieve Dir --------------
String RetrieveDir(char buf[MAX_BUFFER]) // buf = Driver
{
struct ffblk ffblk;
int done,n = 1;
String TempString ;
memmove(buf,buf+5,MAX_BUFFER-5);
strcat(buf,"\\*.*");
done = findfirst(buf,&ffblk,FA_DIREC | FA_HIDDEN | FA_SYSTEM | FA_RDONLY );
if ( done == -1)
{
// it's failed char
}
else
{
while (!done)
{
if(ffblk.ff_name[0] != '.')
{
TempString += ffblk.ff_name;
TempString += '*';
TempString += ffblk.ff_fdate;
if(ffblk.ff_attrib & FA_DIREC)
{
/* process directories*/
}
else /* process files */
{
TempString +='**';
TempString += ffblk.ff_fsize;
TempString +='***';
}
}
done = findnext(&ffblk);
} // End while
} // End else
return TempString;
}
|
| Post Reply
|
|
|
|
|
|
|
|
|
|