home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / unix / internal / 1979 < prev    next >
Encoding:
Text File  |  1992-11-22  |  1.0 KB  |  38 lines

  1. Newsgroups: comp.unix.internals
  2. Path: sparky!uunet!gumby!destroyer!news.iastate.edu!john
  3. From: john@iastate.edu (John Hascall)
  4. Subject: Re: printf() & fork() ......
  5. Message-ID: <By4Lt5.3qM@news.iastate.edu>
  6. Sender: news@news.iastate.edu (USENET News System)
  7. Organization: Iowa State University, Ames, IA
  8. References: <1992Nov19.133035.172@ccsun7.csie.nctu.edu.tw>
  9. Date: Sun, 22 Nov 1992 16:29:29 GMT
  10. Lines: 26
  11.  
  12. mchuang@csie.nctu.edu.tw (Ming-Chuan Huang) writes:
  13. ~void main() {
  14. ~    printf("Hello ");
  15. ~    if (fork() == 0) printf("world\n");
  16. ~}
  17. ~result: Hello Hello world
  18.  
  19. ~void main() {
  20. ~    printf("Hello \n");
  21. ~    if (fork() == 0) printf("world\n");
  22. ~}
  23. }result: Hello
  24.          world
  25. ~is there anybody who knows the difference between the two programs ?
  26.  
  27. Yes.
  28.  
  29. John
  30. (hint: try comp.unix.questions)
  31.  
  32. (useful hint: `line buffered')
  33. -- 
  34. John Hascall                   ``An ill-chosen word is the fool's messenger.''
  35. Systems Software Engineer
  36. Project Vincent
  37. Iowa State University Computation Center  +  Ames, IA  50011  +  515/294-9551
  38.