Cytosim PI Cytoskeleton Simulator

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

List of all members | Public Member Functions | Protected Attributes
FileWrapper Class Reference

## Detailed Description

The FileWrapper has a cast-operator to FILE*, and it can thus be used directly in the functions of the C-library.

Inheritance diagram for FileWrapper:

## Public Member Functions
| FileWrapper ()
| constructor - no file
| FileWrapper (FILE *, const char *path=0)
| constructor which opens a file
| FileWrapper (const char *name, const char *mode)
| constructor which opens a file
virtual | ~FileWrapper ()
| destructor
void | operator= (FILE *)
| constructor from an already opened file
| operator FILE * ()
| automatic conversion to a FILE *
int | open (const char *name, const char *mode)
| open a file More...
void | rewind ()
| rewind file
void | clearerr ()
| rewind file
void | close ()
| close file
FILE * | file ()
| return the file pointer
const char * | path () const
| the path of the file, or of the last attempt to open a file
bool | std () const
| true if output goes to stdout
bool | eof () const
| true if End-Of-File
int | error () const
| return the value of ferror()
bool | good () const
| true if file is good for writing / reading
int | get_pos (fpos_t &p) const
| current position in input file, relative to beggining
void | set_pos (const fpos_t &p)
| set position relative to the beginning of the file
void | put_line (const char *line, char sep=0)
| put string More...
void | put_line (const std::string &line, char sep=0)
| put string
void | get_line (std::string &line, char sep='\n')
| read line, including the terminating ' '; return the position where the line started More...
void | skip_until (const char *str)
| read stream until given string is found More...
void | lock ()
| lock file by the current thread
void | unlock ()
| unlock file
int | getUL ()
| read a character
int | peek ()
| report next character to be read
void | unget (int c)
| report next character to be read
int | write (const char c)
| write a character
void | flush ()
| flush

## Protected Attributes
FILE * | mFile
| the C-file descriptor
std::string | mPath
| the name of the file or some other information:

## Member Function Documentation

void get_line | ( | std::string & | line,
|  | char | sep = `'\n'`
| ) |  |

Returns
  the starting position of the line

int open | ( | const char * | name,
|  | const char * | mode
| ) |  |

remember the path

void put_line | ( | const char * | str,
|  | char | sep = `0`
| ) |  |

This will write the line to output stream. If it is non-zero, 'sep' is also written out.

void skip_until | ( | const char * | str | ) |

This will search for the string and position the stream at the first character of the match. If the `str` is not found, the stream will be positionned at the end of the file, with a eof() state.

The search might fail if `str` contains repeated sequences