Name: Anonymous 2009-03-07 14:13
Explain me this;
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
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