#120996 - Paco_777 - Thu Mar 08, 2007 12:45 am
Hi,
I'm scanning all the filesystem in order to find some specific files.
To achieve this, i'm using the dirnext method of the last devkitARM
I do it this usual way :
I performed my tests on a Supercard SD.
I'm facing a problem : my loop stops with files which have a very big filename.
At least with the following filename in the root directory :
"this is a very big file ndkslepslamdoeldmsoemdoeld this is a very big file ndkslepslamdoeldmsoemdoeld this is a very big file ndkslepslamdoeldmsoemdoeld this is a very big file ndkslepslamdoeldmsothis is a very big file ndkslepslamdoeldmsoemdoeld .txt"
I made another version, trying to use errno in order to bypass incorrect files :
Unfortunately, the loop is endless and the 'bad' filename cannot be bypassed.
Is there a solution for that problem ?
By the way, dirnext should have a maxlength parameter (the size of the filename buffer) in order to avoid memory corruption when
the filename is written to the char *.
_________________
http://Gnese.free.fr/NDS/
I'm scanning all the filesystem in order to find some specific files.
To achieve this, i'm using the dirnext method of the last devkitARM
I do it this usual way :
Code: |
DIR_ITER* dir = diropen (nameTempBufferDir);
if (dir!=NULL) { while (dirnext(dir, nameTempBufferFile, &st) == 0) { // do stuffs } } |
I performed my tests on a Supercard SD.
I'm facing a problem : my loop stops with files which have a very big filename.
At least with the following filename in the root directory :
"this is a very big file ndkslepslamdoeldmsoemdoeld this is a very big file ndkslepslamdoeldmsoemdoeld this is a very big file ndkslepslamdoeldmsoemdoeld this is a very big file ndkslepslamdoeldmsothis is a very big file ndkslepslamdoeldmsoemdoeld .txt"
I made another version, trying to use errno in order to bypass incorrect files :
Code: |
bool dirok;
DIR_ITER* dir = diropen (nameTempBufferDir); if (dir!=NULL) { dirok = ((dirnext(dir, nameTempBufferFile, &st) == 0) || (errno!=ENOENT)); while (dirok) { if (errno!=ENOENT){ // do stuffs } dirok = ((dirnext(dir, nameTempBufferFile, &st) == 0) || (errno!=ENOENT)); } } |
Unfortunately, the loop is endless and the 'bad' filename cannot be bypassed.
Is there a solution for that problem ?
By the way, dirnext should have a maxlength parameter (the size of the filename buffer) in order to avoid memory corruption when
the filename is written to the char *.
_________________
http://Gnese.free.fr/NDS/