• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <assert.h>
2 #include <stdio.h>
3 
main()4 int main() {
5   FILE* file_orig = fopen("/sandbox/input.txt", "r");
6   assert(file_orig != NULL);
7   FILE* file_new = freopen("/sandbox/input2.txt", "r", file_orig);
8   assert(file_new != NULL);
9 
10   int c = fgetc(file_new);
11   while (c != EOF) {
12     int wrote = fputc((char)c, stdout);
13     assert(wrote != EOF);
14     c = fgetc(file_new);
15   }
16 }
17