]> Pileus Git - ~andy/rsl/blobdiff - src/image_gen.c
Revert binary mode for popen
[~andy/rsl] / src / image_gen.c
index ba968c2413b606809ca17d871e267333f479b1c7..f5e79715b28bc6a08e086326d4d56465e3bd9f94 100644 (file)
@@ -82,7 +82,7 @@ void RSL_load_color_table(char *infile, char buffer[256], int *num_colors)
 {
   FILE *fp;
 
-  fp = fopen(infile, "r");
+  fp = fopen(infile, "rb");
   if (fp == NULL) {
        perror(infile);
        exit(-1);
@@ -290,7 +290,7 @@ void RSL_bscan_sweep(Sweep *s, char *outfile)
   FILE *fp;
   if (s == NULL) return;
   
-  fp = fopen(outfile,"w");
+  fp = fopen(outfile,"wb");
   if (fp == NULL) {
        perror(outfile);
        return;
@@ -589,7 +589,7 @@ void RSL_write_ppm(char *outfile, unsigned char *image, int xdim, int ydim, char
     return;
   }
   nbytes = xdim*ydim;
-  fpipe = fopen(outfile, "w");  /* Global FILE * */
+  fpipe = fopen(outfile, "wb");  /* Global FILE * */
   fprintf(fpipe, "P6\n# %s\n%d %d\n255\n",outfile, xdim, ydim);
   for (i=0; i<nbytes; i++)
          if (fwrite(c_table[image[i]], sizeof(char), 3, fpipe) != 3)
@@ -625,7 +625,7 @@ void RSL_write_pgm(char *outfile, unsigned char *image, int xdim, int ydim)
 /*  The following is commented and is for non compressed. */
 #ifdef COMPILE
   nbytes = xdim*ydim;
-  fpipe = fopen(outfile, "w");  /* Global FILE * */
+  fpipe = fopen(outfile, "wb");  /* Global FILE * */
   fprintf(fpipe, "P5\n# %s\n%d %d\n255\n",outfile, xdim, ydim);
   (void)fwrite(image, sizeof(char), nbytes, fpipe);
   (void)fclose(fpipe);