function stops app from exiting correctly [Resolved]

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
sturatt
Posts: 46
Joined: Thu Jul 13, 2006 4:21 pm

function stops app from exiting correctly [Resolved]

Post by sturatt »

This is pretty weird, if i dont call this function, my app closes fine, but when i do, it freezes on exit... i dont get it

Code: Select all

void openPl()
{

    printf("Test\n");
    sceKernelDelayThread(1000000);

    struct SceIoDirent plst;
    int fd = sceIoDopen("./pl/");
    printf("Test2\n");
    sceKernelDelayThread(1000000);

    printf("sceIoDopen worked\n");
    sceKernelDelayThread(1000000);
    char pl_array[50][100];
    int pl_counter = 0;

    int pl_low = 0;
    int pl_high = 12;
    int pl_selected = 0;
    int pl_temp;
    int pl_x = 95, pl_y = 82;

    printf("initialization worked\n");
    if (fd >= 0)
    {

        printf("fd = %i\n", fd);
        sceKernelDelayThread(1000000);
        sceIoDread(fd, &plst);
        printf("%s\n", plst.d_name);
        sceKernelDelayThread(1000000);
    }
    sceIoDclose(fd);
}

commenting out the sceIoDread solves the problem. I'm using sceIoDread and sceIoDopen in other parts of the program... why is it being fussy here?
Last edited by sturatt on Sat Aug 05, 2006 1:46 am, edited 1 time in total.
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

Try adding
memset(&plst, 0, sizeof plst);

That sometimes helps.

Jim
sturatt
Posts: 46
Joined: Thu Jul 13, 2006 4:21 pm

Post by sturatt »

turns out that memset was all it needed.. any idea why?
User avatar
Drakonite
Site Admin
Posts: 990
Joined: Sat Jan 17, 2004 1:30 am
Contact:

Post by Drakonite »

A bug in Sony's code.
Shoot Pixels Not People!
Makeshift Development
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

Unless you have a particular reason not to, I'd suggest sticking with newlib functions like opendir() readdir() etc. because we've already found and worked around these sort of issues.
Post Reply