CMSC 740 - Computer Graphics

File: io.c






/*-------------------------------------------------------------------------
io.c

This file should contain the function for reading-in the images
---------------------------------------------------------------------------*/
#include "sample.h"

/*--------------------------------------------------------------------------
input_dataset() reads in the PPM image from the file
---------------------------------------------------------------------------*/
void input_dataset(char *filename)
{ FILE          *fp;

  int           i;

  if (!(fp = fopen(filename, "r")))
  { fprintf(stderr,"Unable to open input file %s\n", filename);
    exit(-1) ;
  }
  
  /*------------------------------------------------------
   add in stuff here that will determine the number of 
   pixels to be read, dynamically allocate appropriate 
   amount of memory for your data-structures and then
   read-in the data from the file into the data-structures 
  -------------------------------------------------------*/
  
  fclose(fp);
 
}