Confused on num = fork ();

Assume that the write program is a program that writes 100MB of data to a new file on the servers hard drive then it quits.
(I just need an explanation, thanks!)

main();
      ;
      int num;
      while (1>0) 
          {
       num = fork();
     
        if (num > 0)
             { 
              execl(�/usr/local/bin/write�, �write� , NULL);
              printf(�Case One\n�);
              }
           else if ( num == 0) 
               printf(�Case Two\n�);
           else 
               printf(�Case Three\n�);
           }
} 

This looks like a homework question to me, I hope you were told not to try running this program on a production system.

1 Like