fork(3) download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int wide, high;
  5. char c;
  6. if (fscanf(stdin, "%d%d%c", &wide, &high, &c) != 3 || c != '\n') {
  7. printf("Incorrect file format: expected two ints followed by a newline.");
  8. exit(0);
  9. }
  10. printf("W=%d, H=%d", wide, high);
  11. return 0;
  12. }
Success #stdin #stdout 0s 2252KB
stdin
123 456
789 101112
stdout
W=123, H=456