fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. FILE *fp;
  5. int c;
  6.  
  7. fp = fopen("test.txt", "a");
  8. if (fp != 0) {
  9. fwrite("abcdefg", 7, 1, fp);
  10. fseek(fp, 0, SEEK_SET);
  11. fwrite("ABC", 3, 1, fp);
  12. fclose(fp);
  13. }
  14.  
  15. fp = fopen("test.txt", "rb");
  16. if (fp != 0) {
  17. while ((c = fgetc(fp)) != EOF)
  18. putchar(c);
  19. fclose(fp);
  20. }
  21. return 0;
  22. }
  23. /* end */
  24.  
Success #stdin #stdout 0s 4456KB
stdin
Standard input is empty
stdout
Standard output is empty