fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. FILE *fp;
  5. char text[7][100];
  6. int i=0, j=0;
  7.  
  8. printf("qwedfniqwnfiqwf\n");
  9. fp = stdin;
  10.  
  11. //Read over file contents until either EOF is reached or maximum characters is read and store in character array
  12. while(fgets((text)[i++],100,fp) != NULL) ;
  13.  
  14. fprintf(stdout, "%d\n", i);
  15. for (j = 0; j < i; ++j) {
  16. printf("%d: %s\n",j, text[j]);
  17. }
  18.  
  19.  
  20. }
  21.  
Success #stdin #stdout 0s 2160KB
stdin
a
b
sefwef
erghergh
erherh
stdout
qwedfniqwnfiqwf
6
0: a

1: b

2: sefwef

3: erghergh

4: erherh

5: 5�$�R��