fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int ch[3];
  5. int a[3],b[3],c[3];
  6. FILE *file = stdin;
  7. for(int i=0;i<3;i++) {
  8. int z;
  9. if (fscanf(file,"%d",&z) == 1) {
  10. ch[i]=z;
  11. } else {
  12. ch[i]=0;
  13. fscanf(file,"%*s"); // Ignore the input
  14. }
  15. if (fscanf(file,"%d",&z) == 1) {
  16. a[i]=z;
  17. } else {
  18. a[i]=0;
  19. fscanf(file,"%*s"); // Ignore the input
  20. }
  21. if (fscanf(file,"%d",&z) == 1) {
  22. b[i]=z;
  23. } else {
  24. b[i]=0;
  25. fscanf(file,"%*s"); // Ignore the input
  26. }
  27. if (fscanf(file,"%d",&z) == 1) {
  28. c[i]=z;
  29. } else {
  30. c[i]=0;
  31. fscanf(file,"%*s"); // Ignore the input
  32. }
  33.  
  34. printf("%d %d %d %d\n",ch[i],a[i],b[i],c[i]);
  35. }
  36. return 0;
  37. }
  38.  
Success #stdin #stdout 0s 2252KB
stdin
1 2 3 .
2 3 4 5
3 1 2 .
stdout
1 2 3 0
2 3 4 5
3 1 2 0