From 59fd1008ca9cf4e9f75fdd6ee8ec53a2c7d7a13b Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Fri, 11 Mar 2011 10:21:46 +0000 Subject: Wrapped fopen/close/read/write functions inside a simple "IOFile" class. Reading, writing, and error checking became simpler in most cases. It should be near impossible to forget to close a file now that the destructor takes care of it. (I hope this fixes Issue 3635) I have tested the functionality of most things, but it is possible I broke something. :p git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7328 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DiscIO/Src/FileHandlerARC.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'Source/Core/DiscIO/Src/FileHandlerARC.cpp') diff --git a/Source/Core/DiscIO/Src/FileHandlerARC.cpp b/Source/Core/DiscIO/Src/FileHandlerARC.cpp index f1918f6431..a9e4beee5d 100644 --- a/Source/Core/DiscIO/Src/FileHandlerARC.cpp +++ b/Source/Core/DiscIO/Src/FileHandlerARC.cpp @@ -20,7 +20,7 @@ #include "FileHandlerARC.h" #include "StringUtil.h" #include "Blob.h" - +#include "FileUtil.h" #define ARC_ID 0x55aa382d @@ -144,16 +144,9 @@ CARCFile::ExportFile(const std::string& _rFullPath, const std::string& _rExportF return(false); } - FILE* pFile = fopen(_rExportFilename.c_str(), "wb"); - - if (pFile == NULL) - { - return(false); - } + File::IOFile pFile(_rExportFilename, "wb"); - fwrite(&m_pBuffer[pFileInfo->m_Offset], (size_t) pFileInfo->m_FileSize, 1, pFile); - fclose(pFile); - return(true); + return pFile.WriteBytes(&m_pBuffer[pFileInfo->m_Offset], (size_t) pFileInfo->m_FileSize); } -- cgit v1.2.3