From: | Tim Hanson |
Date: | 13 Aug 2001 at 23:45:29 |
Subject: | fstream and ppc-amigaos-g++ |
Hi All,
Firstly, please ignore my previous posting. The answer was RTFM. When
compiling c++ add -liostream to the command line. DOH!
I now have my project compiling ok but it fails on a read() from an opened
fstream object. I`ve done is_open() on the object and it is open but the
machine jams on the first read. On one occasion I got a warpcrash indicating
a load from memory 00000000. The code works fine under 68k so I suspect a
mistake in the command line options.
Any thoughts?
#include "map.h"
#include <stdlib.h>
extern void fail(char *errStr);
char idStr[]="MAP1";
char inBuf[]="DEAD";
Map::Map(fstream& in)
{
cout << in.is_open() << endl;
cout << "About to read" << endl;
in.read(inBuf,4L); <<<-------crashes here.
cout << "Read" << endl;
for(int i=0;i<4;i++)
{
cout << inBuf[i] << endl;
if(inBuf[i]!=idStr[i])
fail("recognise file format");
}
}