get files and subfolders in a directory [resolved]
get files and subfolders in a directory [resolved]
Can anyone help me with going about listing all the files/folders in a directory? I've searched for about an hour.. maybe I'm not searching for the rigtht thing..
I would appreciate any help.
In case this isnt clear, i just want to be able to know what files and folders are in a certian directory.
I would appreciate any help.
In case this isnt clear, i just want to be able to know what files and folders are in a certian directory.
Last edited by sturatt on Sun Jul 30, 2006 4:27 am, edited 1 time in total.
-
- Posts: 9
- Joined: Tue Jul 18, 2006 3:29 pm
me too
I'm having the same trouble finding information about this. I know it's possible because emulators do it. Maybe I should find the source for those and look. I really have an idea of a nice homebrew app that would require the ability to list and select files.
Its very simple to list all the files in a directory, but to save you the extra questions if i posted it, ill just point you to an example of a filebrowser, included with the answre you asked...
Its made by slasher, at PSPU, the thread is Slasher's dump (lol)... I faintly remember seeing a filebrowser example posted...
Its made by slasher, at PSPU, the thread is Slasher's dump (lol)... I faintly remember seeing a filebrowser example posted...
-
- Posts: 9
- Joined: Tue Jul 18, 2006 3:29 pm
Code: Select all
SceIoDirent dir;
int dfd, ok;
char path[]="folder";
dfd = sceIoDopen(path);
if (dfd>=0)
{
for (;;)
{
memset(&dir, 0, sizeof dir);
ok = sceIoDread(dfd, &dir);
if (ok<0) break;
//extract info from dir
}
sceIoDclose(dfd);
}
Jim
Last edited by Jim on Tue Aug 01, 2006 8:19 am, edited 1 time in total.
-
- Posts: 9
- Joined: Tue Jul 18, 2006 3:29 pm
Awesome thanks. But what are the members of the directory struct? I grepped the sdk/include files for sceIoDirent but couldn't find anything. I found the file that contains the prototype for sceIoDopen but that didn't help me. Am I looking in the wrong sdk folder (the one that contains pspkernel.h, pspctrl.h etc.)?
http://forums.qj.net/showthread.php?p=868511#post868511
I know this is resolved, but go here and scroll down to filebrowser example. It's pretty straight forward, and should help you out.
I know this is resolved, but go here and scroll down to filebrowser example. It's pretty straight forward, and should help you out.
Hehe, apparently, that's the way forums work :) Quicker replies are only to be expected on instant messengers/IRC
PS: Sometimes Murphy strikes somewhat too, but oh well, could be worse, couldn't it? :P
PS: Sometimes Murphy strikes somewhat too, but oh well, could be worse, couldn't it? :P
<Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki
Alexander Berl
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki
Alexander Berl
That sample should have "ok<=0" instead of "ok<0". Giving you:
Code: Select all
SceIoDirent dir;
int dfd, ok;
char path[]="folder";
dfd = sceIoDopen(path);
if (dfd>=0)
{
for (;;)
{
memset(&dir, 0, sizeof dir);
ok = sceIoDread(dfd, &dir);
if (ok<=0) break;
//extract info from dir
}
sceIoDclose(dfd);
}