-
Scanning a directory
just by looking at this code can anyone see why it crashes my program each time? it does what its suppose to then when i gets to the last file it crashes.
Code:
char *Buffer;
char *path = "C:\\windows";
char *type = "*.*";
SetCurrentDirectory(path);
struct ffblk ffblk;
int done;
done = findfirst(type,&ffblk,0);
while (!done)
{
char buff[1024];
sprintf(buff,"%s\r\n", ffblk.ff_name);
done = findnext(&ffblk);
}
-
All pointers to string literals should be const char *, but that can't be causing the crash...
A crash cause could be that a filename just might be longer than 1021 characters - unlikely, but possible.