Question: When I read the header of a file ( P 6 1 0 0 #comment #comment 2 0 0 #comment 2 5 5 ) it
When I read the header of a file P#comment #comment #comment it writes to the output file as : P #comment this is incorrect as it should be ignoring all comments, here is the code i am using can you help fix it: Preston Johnson CPSC Fall Username: prestoj Instructor: Dr Yvon Feaster #include "ppmUtil.h void readheaderFILE file headert header ignorecommentsfile; fscanffiles headertype; ignorecommentsfile; fscanffileu &headerwidth; ignorecommentsfile; fscanffileu &headerheight; ignorecommentsfile; fscanffileu &headermaxVal; void writeheaderFILE file const headert header fprintffiles
headertype; fprintffileu
headerwidth; fprintffileu
headerheight; fprintffileu
headermaxVal; void readpixelsFILE file pixelt pixels const headert headerpixels allocatepixelsheader; freadpixels sizeofpixelt headerwidth headerheight, file; void writepixelsFILE file const pixelt pixels const headert header fwritepixels sizeofpixelt headerwidth headerheight, file; pixelt allocatepixelsconst headert header return pixelt mallocheaderwidth headerheight sizeofpixelt; void freepixelspixelt pixels freepixels; void ignorecommentsFILE file int ch; while ch fgetcfile EOF if ch # while ch fgetcfile
&& ch EOF; else ungetcch file; break;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
