jonsca
Quantitative Phrenologist
5,621 posts since Sep 2009
Reputation Points: 1,165
Solved Threads: 581
ptr is not the file, stream is the file, ptr is whatever variable you are reading into (really, a pointer to a block of memory, which they malloced in the example at the bottom of that webpage). Size is the "sizeof" of whatever element you are reading (ints, doubles, etc).
jonsca
Quantitative Phrenologist
5,621 posts since Sep 2009
Reputation Points: 1,165
Solved Threads: 581
I happened to find a good page on PPM files ( http://orion.math.iastate.edu/burkardt/data/ppm/ppm.html ). I think I used them a couple of times in college (in prehistory, here).
From what I remember, they are written and read as plain text files. Are you just trying to write out the numerical values of the file to the screen? If so, I would use a combination of fgets to read in the lines and sscanf to parse them into an array of the numeric values. If you mean that you want to display the actual picture, that will be much more involved.
Hopefully you've made some headway with it yourself.
jonsca
Quantitative Phrenologist
5,621 posts since Sep 2009
Reputation Points: 1,165
Solved Threads: 581