Opening files for reading and writing
We can now create a program to open a file for reading and another file for writing. This is where our file I/O exploration will begin and continue through the remaining chapters of this book. The following program is our starting point:
#include <stdio.h>
#include <stdlib.h>Â Â Â Â Â // for exit()
#include <string.h>Â Â Â Â Â // for strerror()
#include <sys/errno.h>Â Â // for errno
int main( void ) {
  FILE* inputFile;
  FILE* outputFile;
 Â
  char inputFilename[] = "./input.data";
  char outputFilename[] = "./output.data";
 Â
  inputFile = fopen( inputFilename , "r" );
  if( NULL == inputFile )  {
    fprintf( stderr, "input file: %s: %s\n",
     ...