diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/test_hexio.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/test_hexio.c b/src/test_hexio.c index 4dc83e976..9e1e8de80 100644 --- a/src/test_hexio.c +++ b/src/test_hexio.c @@ -17,7 +17,7 @@ ** with historical versions of the "binary" command. So it seems ** easier and safer to build our own mechanism. ** -** $Id: test_hexio.c,v 1.6 2007/10/19 17:47:25 drh Exp $ +** $Id: test_hexio.c,v 1.7 2008/05/12 16:17:42 drh Exp $ */ #include "sqliteInt.h" #include "tcl.h" @@ -119,7 +119,10 @@ static int hexio_read( if( zBuf==0 ){ return TCL_ERROR; } - in = fopen(zFile, "r"); + in = fopen(zFile, "rb"); + if( in==0 ){ + in = fopen(zFile, "r"); + } if( in==0 ){ Tcl_AppendResult(interp, "cannot open input file ", zFile, 0); return TCL_ERROR; @@ -168,7 +171,10 @@ static int hexio_write( return TCL_ERROR; } nOut = sqlite3TestHexToBin(zIn, nIn, aOut); - out = fopen(zFile, "r+"); + out = fopen(zFile, "r+b"); + if( out==0 ){ + out = fopen(zFile, "r+"); + } if( out==0 ){ Tcl_AppendResult(interp, "cannot open output file ", zFile, 0); return TCL_ERROR; |