fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. const int BUF_SIZE = 256;
  6.  
  7. int main(void) {
  8. int buffer0[BUF_SIZE];
  9. int buffer1[BUF_SIZE];
  10. FILE *fp0 = fopen("5-1.txt", "r");
  11. FILE *fp1 = fopen("5-2.txt", "r");
  12. int* p;
  13.  
  14. while((fgets(buffer0, BUF_SIZE, fp0)) && fgets(buffer1, BUF_SIZE, fp1)) {
  15. if (strcmp(buffer0, buffer1) == 0) {
  16. p = strchr(buffer0, '\n');
  17. *p = 0;
  18. puts(buffer0);
  19. } else {
  20. puts("*");
  21. }
  22. }
  23.  
  24. return EXIT_SUCCESS;
  25. }
  26.  
Runtime error #stdin #stdout 0.01s 5408KB
stdin
Standard input is empty
stdout
Standard output is empty