fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. FILE *spdata;
  5. FILE *spdata2;
  6. char ch[100];
  7. char chr;
  8. printf("Enter your specific character");
  9. scanf("%c", &chr);
  10. spdata = fopen("file29_1.txt", "r");
  11. spdata2 = fopen("file29_2.txt", "w");
  12. while((fgets(ch,100,spdata))!=NULL)
  13. {
  14. if(chr==ch[0])
  15. {
  16. fputs(ch,spdata2);
  17. }
  18. else
  19. {
  20. continue;
  21. }
  22. }
  23. fclose(spdata);
  24. fclose(spdata2);
  25. return 0;
  26. }
  27.  
Runtime error #stdin #stdout 0s 9416KB
stdin
Standard input is empty
stdout
Standard output is empty