From c3c9fac55bab535010c6857b8e8e0587d4d2348f Mon Sep 17 00:00:00 2001 From: Marcus Comstedt Date: Sun, 3 Aug 2003 15:38:27 +0000 Subject: Don't use level 1 I/O, it's not part of the C++ standard... svn-id: r9432 --- sword2/tony_gsdk.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'sword2') diff --git a/sword2/tony_gsdk.cpp b/sword2/tony_gsdk.cpp index 85fd1f653a..364fafe191 100644 --- a/sword2/tony_gsdk.cpp +++ b/sword2/tony_gsdk.cpp @@ -27,7 +27,7 @@ //general odds and ends #include -#include +//#include //#include #include #include @@ -118,22 +118,21 @@ int32 Direct_read_file(const char *name, char *ad) //Tony1May96 int32 Direct_write_file(const char *name, char *ad, uint32 total_bytes) //Tony1May96 { //load the file directly into the memory location passed - int fh; + FILE *fh; - //fh = open(name, _O_RDWR | _O_CREAT); //open for reading - fh = open(name, O_RDWR | O_CREAT); //open for reading + fh = fopen(name, "wb"); //open for writing - if (fh==-1) + if (fh==NULL) { Zdebug("Direct_write_file open fail %d", name); return(-1); } - if (write( fh, ad, total_bytes)==-1) + if (fwrite( ad, 1, total_bytes, fh)!=total_bytes) { Zdebug("Direct_write_file write fail %d", name); return(-1); } - close(fh); + fclose(fh); return(0); //ok, done it } -- cgit v1.2.3