This is done using equivalents of getchar and putchar which are called getc and putc. Each takes an extra argument, which identifies the file pointer to be used for input or output.
Go to file pointers Go to Index Go to Formatted I/O