aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Comstedt2003-08-03 15:38:27 +0000
committerMarcus Comstedt2003-08-03 15:38:27 +0000
commitc3c9fac55bab535010c6857b8e8e0587d4d2348f (patch)
tree8ee03d3bea08e75f537d4577e775cf4576a2c29f
parentfa45a69614ed3cbe476b45cc2ab16d2bb65ec21f (diff)
downloadscummvm-rg350-c3c9fac55bab535010c6857b8e8e0587d4d2348f.tar.gz
scummvm-rg350-c3c9fac55bab535010c6857b8e8e0587d4d2348f.tar.bz2
scummvm-rg350-c3c9fac55bab535010c6857b8e8e0587d4d2348f.zip
Don't use level 1 I/O, it's not part of the C++ standard...
svn-id: r9432
-rw-r--r--sword2/tony_gsdk.cpp13
1 files changed, 6 insertions, 7 deletions
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 <sys/stat.h>
-#include <fcntl.h>
+//#include <fcntl.h>
//#include <io.h>
#include <stdarg.h>
#include <stdio.h>
@@ -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
}