Elaboradar 0.1
|
Open a file taking its name from a given env variable. Continua...
#include <utils.h>
Membri pubblici | |
bool | open_from_env (const char *varname, const char *mode, const char *desc=nullptr) |
Opens a file taking its name from the environment variable envname. | |
bool | open (const std::string &fname, const char *mode, const char *desc=nullptr) |
Opens a file by its pathname. | |
operator FILE * () | |
Allows FILEFromEnv objects to be used as FILE pointers. | |
operator bool () const | |
Allows FILEFromEnv to be used in an if (...) to check if the file is open. | |
bool | fread (void *buf, size_t size) |
Performs a fread on the file, throwing an exception if anything goes wrong. | |
void | read_lines (std::function< void(char *, size_t)> line_cb) |
Read the file line by line, calling line_cb on each line read. | |
Open a file taking its name from a given env variable.
If the variable is not set, assume a 'false' value.