#include <file.h>
Inheritance diagram for ucommon::file:
Public Types | |
typedef ::fpos_t | bookmark_t |
Public Member Functions | |
void | append (void) |
int | cancel (void) |
Cancel pipe and close file. | |
void | clear (void) |
Clear error state. | |
int | close (void) |
Close an open file. | |
bool | eof (void) |
int | err (void) |
file () | |
Construct an unopened file. | |
file (char *path, char **argv, char *mode, char **envp=((void *) 0)) | |
Construct an open file based on a pipe. | |
file (char *path, char *mode, size_t size=2) | |
Construct an open file based on a path and mode. | |
file (FILE *file) | |
Construct a file from an existing FILE pointer. | |
void | flush (void) |
void | get (bookmark_t &pos) |
int | get (void) |
size_t | get (void *data, size_t size) |
char * | gets (char *data, size_t size) |
bool | good (void) |
Check if file is good, no error or eof. | |
bool | is_tty (void) |
void | move (long offset) |
template<typename T> | |
void | offset (long pos) |
void | open (char *path, char **argv, char *mode, char **envp=((void *) 0)) |
Open an executable path. | |
void | open (char *path, char *mode, size_t size=2) |
Open file path. | |
operator bool () | |
Test if file is opened. | |
operator FILE * () | |
bool | operator! () |
Test if file is not opened. | |
size_t | printf (char *format,...) |
int | push (char value) |
int | put (char value) |
size_t | put (void *data, size_t size) |
int | puts (char *data) |
template<typename T> | |
size_t | read (T &data) |
template<typename T> | |
size_t | read (T *data, size_t count) |
void | rewind (void) |
size_t | scanf (char *format,...) |
void | seek (long offset) |
void | set (bookmark_t &pos) |
template<typename T> | |
size_t | write (T &data) |
template<typename T> | |
size_t | write (T *data, size_t count) |
~file () | |
Destroy object and close associated file. | |
Static Public Attributes | |
static file | cerr |
static file | cin |
static file | cout |
This can also be used as an alternative means to access files that manages file pointers.
Definition at line 59 of file file.h.
ucommon::file::file | ( | FILE * | file | ) |
Construct a file from an existing FILE pointer.
file | to use. |
ucommon::file::file | ( | char * | path, | |
char * | mode, | |||
size_t | size = 2 | |||
) |
Construct an open file based on a path and mode.
path | of file to open. | |
mode | of file. | |
size | of buffer, 0 = none, 1 = line mode, 2 = default |
ucommon::file::file | ( | char * | path, | |
char ** | argv, | |||
char * | mode, | |||
char ** | envp = ((void *) 0) | |||
) |
Construct an open file based on a pipe.
path | of file to pipe. | |
argv | of executable. | |
mode | of file. | |
envp | to give executable. |
int ucommon::file::cancel | ( | void | ) |
Cancel pipe and close file.
int ucommon::file::close | ( | void | ) |
Close an open file.
bool ucommon::file::good | ( | void | ) |
Check if file is good, no error or eof.
..
void ucommon::file::open | ( | char * | path, | |
char ** | argv, | |||
char * | mode, | |||
char ** | envp = ((void *) 0) | |||
) |
Open an executable path.
path | of executable. | |
argv | to pass to executable. | |
mode | of pipe (only "r" and "w" are valid). |
void ucommon::file::open | ( | char * | path, | |
char * | mode, | |||
size_t | size = 2 | |||
) |
Open file path.
If a file is already opened, it is closed.
path | of file to open. | |
mode | of file to open. | |
size | of buffering, 0 = none, 1 = line mode. |
ucommon::file::operator bool | ( | ) | [inline] |
bool ucommon::file::operator! | ( | ) | [inline] |