Homebrew No direnext?

cwstjdenobs

Sodomy non sapiens
OP
Member
Joined
Mar 10, 2009
Messages
1,756
Trophies
0
Location
Ankh-Morpork
Website
Visit site
XP
205
Country
Ok, so I'm trying to compile some stuff I know used to work, but I don't seem to have dirnext, diropen, et al.

Now have I forgot to install something, or do I just have to stop being lazy and fix my code?
 

jskyboo

Well-Known Member
Member
Joined
Sep 12, 2009
Messages
288
Trophies
0
XP
191
Country
United States
cwstjdenobs said:
Ok, so I'm trying to compile some stuff I know used to work, but I don't seem to have dirnext, diropen, et al.

Now have I forgot to install something, or do I just have to stop being lazy and fix my code?
After switching to the new devkitPPC 23 and libogc 1.8.7 I got the same errors. I believe we include for those functions. Im not sure why they no longer can be found but as I need them for now Im staying on the previous devkitPPC.
 

Jacobeian

Well-Known Member
Member
Joined
May 15, 2008
Messages
1,893
Trophies
0
XP
387
Country
Cuba
You need to replace diropen by "opendir", dirclose by "closedir" and dirnext with "readdir".

The new open/close functions use "DIR" structure, not "DIR_ITER", and readdir usage is substantially different from dirnext so you want to learn how to use it first.
 

jskyboo

Well-Known Member
Member
Joined
Sep 12, 2009
Messages
288
Trophies
0
XP
191
Country
United States
Jacobeian said:
You need to replace diropen by "opendir", dirclose by "closedir" and dirnext with "readdir".

The new open/close functions use "DIR" structure, not "DIR_ITER", and readdir usage is substantially different from dirnext so you want to learn how to use it first.
Thanks for the tip. So what changed that caused this because I read the notes for the release and nothing screams "This will break uses of diropen...."?

For those having similar issues, to use readdir where you used dirnext here is a small bit of sample code to show how to use it:
CODE#include
#include

....

char fullpath[80];
char path[] = "sd:\";
DIR *dir = NULL;
struct dirent * temp = NULL;
struct stat filestat;

dir = opendir(path);
if (dir != NULL) {
ÂÂtemp = readdir(dir);
ÂÂif(temp != NULL ) {
ÂÂÂÂsnprintf(fullpath, sizeof(fullpath), "%s/%s", path, temp->d_name);
ÂÂÂÂif(stat( fullpath, &filestat) == 0) {
ÂÂÂÂÂÂ//blah
ÂÂÂÂ}
ÂÂ}
}
closedir(dir);
 

tueidj

I R Expert
Member
Joined
Jan 8, 2009
Messages
2,569
Trophies
0
Website
Visit site
XP
999
Country
opendir/readdir/closedir are standard(-ish) C functions, while diropen/dirnext/dirclose are internal functions specific to devkitpro. Someone decided it was time everyone started using the "regular" functions so the other ones aren't exposed for outside use anymore.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    SylverReZ @ SylverReZ: @K3Nv2 https://www.youtube.com/watch?v=9yWIobzBdKc