37 using std::runtime_error;
54 getline( stream,str );
57 ic = str.find_first_of(
'#' );
58 if (ic != string::npos) str.erase( str.begin()+ic,str.end() );
61 ic = str.find_first_not_of(
' ' );
62 if ((
int)ic > 0) str.erase( str.begin(),str.begin()+ic );
65 ic = str.find_last_not_of(
' ' );
66 if (ic != string::npos) str.erase( str.begin()+ic+1,str.end() );
69 else throw runtime_error(
"could not read line from file." );
82 template <
class T>
void ReadBinary( ifstream &stream, T &val )
85 stream.read( (
char*) &val,
sizeof(T) );
87 throw runtime_error(
"could not read data from file." );
97 template <
class T>
void WriteBinary( ofstream &stream,
const T &val )
99 stream.write( (
char*) &val,
sizeof(T) );
string ReadLine(ifstream &stream)
Definition: streamIO.h:47
void ReadBinary(ifstream &stream, T &val)
Definition: streamIO.h:82
void WriteBinary(ofstream &stream, const T &val)
Definition: streamIO.h:97