Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
another attempt to set stdout binary mode on win
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12906 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek committed Feb 9, 2010
1 parent 1ccd3df commit 35a70d3
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/providers/grass/qgis.d.rast.c
Expand Up @@ -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>
Expand Down Expand Up @@ -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++ )
{
Expand Down

0 comments on commit 35a70d3

Please sign in to comment.