Skip to content
Permalink
Browse files

another attempt to set stdout binary mode on win

git-svn-id: http://svn.osgeo.org/qgis/trunk@12906 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek
rblazek committed Feb 9, 2010
1 parent f4c042d commit 7df3c9c5ff9874176379208d5550a427f51b16f2
Showing with 12 additions and 4 deletions.
  1. +12 −4 src/providers/grass/qgis.d.rast.c
@@ -13,6 +13,10 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef WIN32
#include <fcntl.h>
#include <io.h>
#endif
#include <grass/gis.h>
#include <grass/raster.h>
#include <grass/display.h>
@@ -131,10 +135,14 @@ static int cell_draw( char *name,
blu = G_malloc( ncols );
set = G_malloc( ncols );

/* some buggy C libraries require BOTH setmode() and fdopen(bin) ? */
//setmode(fileno(stdin), O_BINARY);
fo = fdopen( fileno( stdout ), "wb" );

/* some buggy C libraries require BOTH setmode() and fdopen(bin) */
#ifdef WIN32
if ( _setmode( _fileno( stdout ), _O_BINARY ) == -1 )
G_fatal_error( "Cannot set stdout mode" );
#endif
// Unfortunately this is not sufficient on Windows to switch stdout to binary mode
fo = fdopen (fileno(stdout), "wb");

/* loop for array rows */
for ( row = 0; row < nrows; row++ )
{

0 comments on commit 7df3c9c

Please sign in to comment.
You can’t perform that action at this time.