#include <cstdlib>
#include <fstream>
#include <iostream>
#include <stdexcept>
#include <string>
Go to the source code of this file.
|
| string | ReadLine (ifstream &stream) |
| |
| template<class T > |
| void | ReadBinary (ifstream &stream, T &val) |
| |
| template<class T > |
| void | WriteBinary (ofstream &stream, const T &val) |
| |
Functions for input/output operations on file streams.
template<class T >
| void ReadBinary |
( |
ifstream & |
stream, |
|
|
T & |
val |
|
) |
| |
Reads the next value from a binary file.
- Parameters
-
| stream | file stream |
| val | value in the file |
- Exceptions
-
| std::runtime_error | problem with the stream |
| string ReadLine |
( |
ifstream & |
stream | ) |
|
|
inline |
Reads a text line from file, strips any comment, leading and trailing spaces. It is assumed that a comment starts with the hash (#) sign.
- Parameters
-
- Returns
- processed line as a string (might be empty!)
- Exceptions
-
| std::runtime_error | problem with the stream |
template<class T >
| void WriteBinary |
( |
ofstream & |
stream, |
|
|
const T & |
val |
|
) |
| |
Writes given value to a binary file.
- Parameters
-
| stream | file stream |
| val | value to be written |