Hello everyone, it's me, again...
I've been working with IO functions for a while, but this is the first time i have to use directory listing...
After a lot of effort, I managed to get the function working, but it's returning an strange behavior...
For testing proposes i've just implemented a count function, but it always gave me an strange result:
real number of directories/files + 3
Then, i decided to print the damn results, and the information was a little bit strange:
(NULL)
.
..
(after the above, the listing goes fine)
What may be going on?
sceIoDread strange behavior...
Re: sceIoDread strange behavior...
NULL is something, not sure.victorprosa wrote:Hello everyone, it's me, again...
I've been working with IO functions for a while, but this is the first time i have to use directory listing...
After a lot of effort, I managed to get the function working, but it's returning an strange behavior...
For testing proposes i've just implemented a count function, but it always gave me an strange result:
real number of directories/files + 3
Then, i decided to print the damn results, and the information was a little bit strange:
(NULL)
.
..
(after the above, the listing goes fine)
What may be going on?
. is current working directory
.. is top directory (One above)
Programming with:
Geany + Latest PSPSDK from svn
Geany + Latest PSPSDK from svn
-
- Posts: 37
- Joined: Wed Jan 14, 2009 5:53 am
Re: sceIoDread strange behavior...
Yeah, i know, but the documentation doesn't help in this case:NoEffex wrote:
NULL is something, not sure.
. is current working directory
.. is top directory (One above)
It don't tell what does the NULL mean, and why it is giving me the ".", the ".." is understandable, but it shouldn't be there, as soon as the command should be a directory listing, the ".." should be implemented by a further file explorer...Returns:
Read status
* 0 - No more directory entries left
* > 0 - More directory entired to go
* < 0 - Error
-
- Posts: 18
- Joined: Thu Aug 13, 2009 11:42 pm
The "." and ".." results are normal behaviour (compare readdir()). The NULL result looks strange, might this be an error in your code?
This works for me:
produces
This works for me:
Code: Select all
pspDebugScreenInit();
SceUID id = sceIoDopen("ms0:/psp");
SceIoDirent entry;
while (sceIoDread(id, &entry) > 0)
{
pspDebugScreenPrintf("'%s'\n", entry.d_name);
}
sceIoDclose(id);
Code: Select all
'.'
'..'
'COMMON'
'GAME'
'GAME150'
'RSSCH'
'SAVEDATA'
'SYSTEM'
'THEME'
'RADIOPLAYER'
-
- Posts: 37
- Joined: Wed Jan 14, 2009 5:53 am
Well, I discovered that for a strange reason, only MP_ROOT, the folder where i was testing this stuff gives the NULL, LOL
Anyway, I use a similar code, but mine has to be FAR way bigger...
I am using VLF, then, the printf trick doesn't work, my code is a giant, with a lot of if(done > 0) {//do it again}
Hate these kind of dificulties of VLF, but it is so beautiful *.*
If you have any idea to shorten the code, it is apreciated, anyway, thanks for your help.... =]
Anyway, I use a similar code, but mine has to be FAR way bigger...
I am using VLF, then, the printf trick doesn't work, my code is a giant, with a lot of if(done > 0) {//do it again}
Hate these kind of dificulties of VLF, but it is so beautiful *.*
If you have any idea to shorten the code, it is apreciated, anyway, thanks for your help.... =]