Browse Source

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

Fixes ticket #8638.
Carl Eugen Hoyos 4 years ago
parent
commit
68f637b6f9
2 changed files with 2 additions and 2 deletions
  1. 1 1
      doc/examples/decode_video.c
  2. 1 1
      doc/examples/hw_decode.c

+ 1 - 1
doc/examples/decode_video.c

@@ -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);

+ 1 - 1
doc/examples/hw_decode.c

@@ -223,7 +223,7 @@ int main(int argc, char *argv[])
     }
 
     /* open the file to dump raw data */
-    output_file = fopen(argv[3], "w+");
+    output_file = fopen(argv[3], "w+b");
 
     /* actual decoding and dump the raw data */
     while (ret >= 0) {