reading/writing to a file using getchar/putchar
Posted on 1997-11-29
How would I copy a file using getchar and putchar? I have to use those function calls. As far as I can tell, those functions read and write from/to stdin and stdout. The only way I have figured so far, is to use freopen to open the files. However, I need to write to the screen after I have finished copying the file. If I were to use freopen, how can I tell it to stop using the file as stdout? Or, if you could suggest a way other than freopen, what would that be? I can not use function calls like fgetc or fputc. I have to use getchar and putchar.