Question: system programing linux and unix !! explain this code ! 8.5 fork and standard I/O Consider this code: #include main() Programming Exercises 281 FILE p

system programing linux and unix !! explain this code !

system programing linux and unix !! explain this code ! 8.5 fork

8.5 fork and standard I/O Consider this code: #include main() Programming Exercises 281 FILE p int pid; char msg1[] = "Testing 1 2 3 .. "; char msg2 "Hello, helloln; if ( (fp= fopen ("testfile2 " , "w")) = NULL ) return 0 fprint f { fp, "%s ", msg1); if (pidfork))1 return 0 fprintf (fp, "s", msg2) fclose (fp) i return 1; Test this program. How many messages appear in the file? Explain the results. Compare this program to the output of forkdemol.c in the text 8.6 Background processing Compile and run this program: main() int i; if fork)0) Eor i-1i 10 i++ ) exit (0) printf ("still here. n" sleep(i) return 0 xplain what this program does and how it works. Unix shells allow users to run programs in the background. How is this program similar to a background process

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!