From: Christopher Lambert Newsgroups: comp.os.msdos.djgpp Subject: Allegro: Killing ifstream? Date: Sat, 02 May 1998 20:04:23 -0700 Organization: INFOSTORM Lines: 53 Message-ID: <354BDEB7.AEB487DF@pobox.com> Reply-To: chrislambert AT pobox DOT com NNTP-Posting-Host: 209.53.30.181 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Hi All, Allegro seems to be choking whenever I try to use an ifstream object. In the following code, "numtiles" exists within the Game object (its an 'int'). The program runs until you get to the line: file >> numtiles; Where it dies a brutal death and GPF's. The file exists, the variable is valid, the a_filename is perfectly fine and filename is allocated properly with the appropraite file path. This sucks because we have another method exactly the same that works perfectly fine (all deallocation is done). Any thoughts? Chris /* loadTileDefinitions: Loads all tile definitions from disk and builds the maps tile list. */ void Game::loadTileDefinitions (char * a_filename) { // local variables ifstream file; char *filename; // grab a new copy of filename filename = strdup(a_filename); filename = strcat(filename, ".til"); if (!filename) Error::error ("File Name Could Not Be Allocated"); // open file file.open(filename, ios::in); if (!file) Error::error ("Tile Definition Could Not Be Opened"); // read in the number of tiles file >> numtiles; // close file and delete char * file.close(); delete filename; } //loadTileDefinitions -- ------------------------------------------------------------------ Christopher Lambert chrislambert AT pobox DOT com, infostorm AT pobox DOT com INFOSTORM Software Development and Consulting Services Software Developer CPA, Java Programmer 1.1 Certified ------------------------------------------------------------------