fork(1) download
  1. #include <stdio.h>
  2. main ( )
  3. {
  4. int c;
  5. while (c = (getchar ( ) != EOF))
  6. printf ("%d\n", c);
  7. /* As long as getchar didn't return EOF c should get value of 1 */
  8. printf ("at EOF c is ");
  9. printf ("%d\n", c);
  10. /* the above two lines can be assembled together by writing printf ("at EOF
  11. c is %d\n", c; */
  12. }
Success #stdin #stdout 0s 5456KB
stdin
Standard input is empty
stdout
at EOF c is 0