- fprintf(ppm, "P6\n640 480\n255\n");
- fwrite(buf, 640*480*3, 1, ppm);
+ fwrite("\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00", 12, 1, ppm);
+ {
+ unsigned short w = WIDTH;
+ fwrite(&w, 2, 1, ppm);
+ }
+ {
+ unsigned short h = HEIGHT;
+ fwrite(&h, 2, 1, ppm);
+ }
+ fwrite("\x18\x00", 2, 1, ppm);
+ fwrite(buf, WIDTH*HEIGHT*3, 1, ppm);