doc/examples: Always open files as "binary", not "text".

Fixes ticket #8638.
This commit is contained in:
Carl Eugen Hoyos
2020-06-25 00:01:36 +02:00
parent c8ba0daf8d
commit 68f637b6f9
2 changed files with 2 additions and 2 deletions

View File

@@ -41,7 +41,7 @@ static void pgm_save(unsigned char *buf, int wrap, int xsize, int ysize,
FILE *f;
int i;
f = fopen(filename,"w");
f = fopen(filename,"wb");
fprintf(f, "P5\n%d %d\n%d\n", xsize, ysize, 255);
for (i = 0; i < ysize; i++)
fwrite(buf + i * wrap, 1, xsize, f);