Unstruct2D  1.0
Solution of 2-D Euler- and Navier-Stokes Equations on Unstructured Triangular Grids
 All Classes Files Functions Variables Typedefs Enumerations Macros
streamIO.h File Reference
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <stdexcept>
#include <string>

Go to the source code of this file.

Functions

string ReadLine (ifstream &stream)
 
template<class T >
void ReadBinary (ifstream &stream, T &val)
 
template<class T >
void WriteBinary (ofstream &stream, const T &val)
 

Detailed Description

Functions for input/output operations on file streams.

Function Documentation

template<class T >
void ReadBinary ( ifstream &  stream,
T &  val 
)

Reads the next value from a binary file.

Parameters
streamfile stream
valvalue in the file
Exceptions
std::runtime_errorproblem 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
streamfile stream
Returns
processed line as a string (might be empty!)
Exceptions
std::runtime_errorproblem with the stream
template<class T >
void WriteBinary ( ofstream &  stream,
const T &  val 
)

Writes given value to a binary file.

Parameters
streamfile stream
valvalue to be written