/* Copyright (C) 1994-2003 Revolution Software Ltd * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Header$ */ // general odds and ends #include "stdafx.h" #include "sword2/sword2.h" #include "sword2/driver/driver96.h" #include "sword2/debug.h" #include "sword2/memory.h" namespace Sword2 { uint32 Sword2Engine::readFile(const char *name, mem **membloc, uint32 uid) { // read the file in and place into an allocated MEM_float block File fh; uint32 size; if (!fh.open(name)) { debug(5, "Read_file cannot open %s", name); return 0; } size = fh.size(); // reserve enough floating memory for the file *membloc = memory->allocMemory(size, MEM_float, uid); if (fh.read((*membloc)->ad, size) != size) { debug(5, "Read_file read fail %d", name); return 0; } fh.close(); // ok, done it - return bytes read return size; } } // End of namespace Sword2