1 // Emacs style mode select -*- C++ -*- 2 //----------------------------------------------------------------------------- 3 // 4 // $Id: m_fileio.h 4469 2014-01-03 23:38:29Z dr_sean $ 5 // 6 // Copyright (C) 1993-1996 by id Software, Inc. 7 // Copyright (C) 2006-2014 by The Odamex Team. 8 // 9 // This program is free software; you can redistribute it and/or 10 // modify it under the terms of the GNU General Public License 11 // as published by the Free Software Foundation; either version 2 12 // of the License, or (at your option) any later version. 13 // 14 // This program is distributed in the hope that it will be useful, 15 // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 // GNU General Public License for more details. 18 // 19 // DESCRIPTION: 20 // File Input/Output Operations 21 // 22 //----------------------------------------------------------------------------- 23 24 #ifndef __M_FILEIO__ 25 #define __M_FILEIO__ 26 27 #include <string> 28 #include <vector> 29 30 #include <stdio.h> 31 32 #include "doomtype.h" 33 #include "d_main.h" 34 35 SDWORD M_FileLength (FILE *f); 36 bool M_FileExists(const std::string& filename); 37 38 BOOL M_WriteFile(std::string filename, void *source, QWORD length); 39 QWORD M_ReadFile(std::string filename, BYTE **buffer); 40 41 BOOL M_AppendExtension (std::string &filename, std::string extension, bool if_needed = true); 42 void M_ExtractFilePath(const std::string& filename, std::string &dest); 43 bool M_ExtractFileExtension(const std::string& filename, std::string &dest); 44 void M_ExtractFileBase (std::string filename, std::string &dest); 45 void M_ExtractFileName (std::string filename, std::string &dest); 46 std::string M_ExtractFileName(const std::string filename); 47 48 #endif 49