Expand|Select|Wrap|Line Numbers
- #include "transform.h"
- int main (int argc, char *argv[]) {
- // declarations here
- FILE *inFile;
- // open input file
- inFile = fopen("tiger.ppm", "r")
- if (inFile == NULL){
- fprintf(stderr,"Output failure. Exiting program\n");
- exit(2);
- }
- // parseHeader function call here
- parseHeader();
- // malloc space for the array (example given in assignment write-up)
- struct pixel * image = (struct pixel *) malloc(sizeof(struct pixel) * g_width * g_height);
- // parseImage function call here
- parseImage();
- // close input file
- fclose(inFile);
- // manipulate the image according to command-line parameter
- // 1: mirror image
- // 2: upside down image
- // 3: rotate to the right 90 degrees
- if(argv[1]){
- mirror();
- }
- if else(argv[2]){
- flipHorz();
- }
- if else (argv[3]){
- rotate();
- }
- return 0;
- }
Expand|Select|Wrap|Line Numbers
- #include "transform.h"
- int print(void){
- FILE *inFile
- inFile = fopen("tiger.ppm", "r");
- if(!inFile){
- fprintf(stderr, "File open error. Exiting program\n");
- exit(1);
- }