I have been using fopen, fread, fwrite, etc for all my file needs, and it has been working fine, but now i need the ability to scan a directory for all files contained within. I looked at the sdk and decided i need sceIoDopen and sceIoDread (i think), so now i'm trying to get them working... to no avail. My problems are:
A) relative filepaths seem to not work at all... this isnt a horrible problem, but i'd rather not use absolute paths if possible.
B) after trying a relative path, i get error code 12 (0xC), the same as when i try an absolute path beginning with "ms0:/"
C) Using "device:/PSP/GAME/MyFolder/MySubfolder/" gives me (i believe) a good return SceUID, but then when i try to read files from it, it doesnt return anything.
Anyway, here's what I have and my output, any help would be appreciated:
Code: Select all
// Note that the folder device:/PSP/GAME/LatestBreakIn/data/ contains the
// file bgpic.raw. This is what I would love to see output...
int res, i, j;
SceIoDirent info;
SceUID fdesc = sceIoDopen("device:/PSP/GAME/LatestBreakIn/data/");
sprintf(buf,"Code: %x",(int)fdesc);
for(i=0;i<300;i++)
{
Print(0,1,0xFF,buf);
CopyBuf();
}
res = sceIoDread(fdesc,&info);
if(res<0)
for(i=0;i<300;i++)
{
Print(0,0,0xFF,"Error opening thingy.");
CopyBuf();
}
else
for(i=0;i<300;i++)
{
Print(1,2,0xFF,info.d_name);
CopyBuf();
}
/*
Output:
"Code: 80020321"
"Error opening thingy."
*/