I am trying to write a mandelbrot set procedure to a ppm file. I can write the file ok and open it using gimp but the picture is not correct .. I am not sure what is wrong though my first impression is that I am writing the bytes the wrong way around ..

edit: no its not that I have tried 3 different approaches one to a binary ppm file one to an ascii ppm file and another ascii to console and they all give the same pic which is not correct .. I have edited the code it was pretty horrible so hopefully this makes more sense