Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

fucking system programming

Name: Anonymous 2009-03-07 14:13

Explain me this;

int main (int argc, const char * argv[])
{       
    pid_t pid;
   
    if (pid<0)
    {
        printf("epic fail\n");
        return 1;
    }
    else if (pid ==0)
    {
        printf("omg child process");
    }
    else
    {
        wait(NULL);
        //child complete if any
        printf("parent\n");
    }
    return 0;
}


when executed, you expect this to just say parent, as there is no fork (yet) - however, when I run it by compiling myself via gcc, I get epic fail (which obviously shouldn't happen), and if I do it via the automated compiler of xcode, which is just a front-end for gcc, I get "child process"

so basically I get the two responses I shouldn't be getting

WHAT THE FUCK IS THIS

HELP ME, /prog/ YOU'RE MY LAST RESORT

Name: Anonymous 2009-03-07 17:59

>>15
I believe you are looking for /pr/

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List