File read/write utilities: text parsing and binary I/O.
Low-level helpers for reading and writing text and binary files. Includes functions for parsing space- or line-separated input files (with comment stripping), reading (x, y) data, and variadic binary read/write for PoD types, vectors, and strings.
- Warning
- Many functions in this namespace are old and some are obsolete. Use sparingly and with caution – prefer higher-level IO interfaces where available.
|
| std::pair< std::vector< double >, std::vector< double > > | readFile_xy_PoV (const std::string &fname) |
| | Reads (x, y) pairs from a file; returns a pair of vectors {xs, ys}. Lines beginning with '#', '!', or '//' are skipped.
|
| |
| void | removeBlockComments (std::string &input) |
| | Removes C-style block comments (/* ... */) from a string in-place.
|
| |
| std::string | removeCommentsAndSpaces (const std::string &input) |
| | Strips comments (#, !, //, /* */), spaces, tabs, and quote characters. Lines are squashed together; semicolons are preserved as delimiters.
|
| |
| void | open_binary (std::fstream &stream, const std::string &fname, RoW row) |
| | Opens a binary fstream for reading or writing according to row.
|
| |
| bool | file_exists (const std::string &fileName) |
| | Returns true if the file at fileName exists and can be opened.
|
| |
| template<typename T , typename... Types> |
| void | rw_binary (std::fstream &stream, RoW row, std::vector< T > &value, Types &...values) |
| | Function (variadic): reads/writes data from/to binary file. Works for trivial (PoD) types, and std::string only (but not checked) Overload for vectors.
|
| |
| template<typename T , typename... Types> |
| void | rw_binary (std::fstream &stream, RoW row, T &value, Types &...values) |
| | Function (variadic): reads/writes data from/to binary file. Works for trivial (PoD) types, and std::string only (but not checked)
|
| |
|
template<typename T > |
| void | binary_rw (std::fstream &stream, T &value, RoW row) |
| |
|
template<typename T > |
| void | binary_rw_vec (std::fstream &stream, std::vector< T > &value, RoW row) |
| |
|
void | binary_str_rw (std::fstream &stream, std::string &value, RoW row) |
| |