Access standard files through character protocol.
More...
#include <fsys.h>
Public Types |
typedef ::fpos_t | bookmark_t |
Public Member Functions |
void | append (void) |
| charfile (FILE *file) |
| Construct a charfile from an existing FILE pointer.
|
| charfile (char *path, char *mode) |
| Construct an open charfile based on a path and mode.
|
| charfile () |
| Construct an unopened file.
|
void | close (void) |
| Close an open file.
|
bool | eof (void) |
int | err (void) |
size_t | get (void *data, size_t size) |
void | get (bookmark_t &pos) |
bool | istty (void) |
void | move (long offset) |
void | open (char *path, char *mode) |
| Open file path.
|
| operator bool () |
| Test if file is opened.
|
bool | operator! () |
| Test if file is not opened.
|
size_t | printf (char *format,...) |
size_t | put (char *string) |
| Put a string into the file.
|
size_t | put (void *data, size_t size) |
size_t | readline (char *string, size_t size) |
| Read a line of input from the file.
|
size_t | readline (string &string) |
| Read a string of input from the file.
|
void | rewind (void) |
void | seek (long offset) |
void | set (bookmark_t &pos) |
| ~charfile () |
| Destroy object and close associated file.
|
int | get (void) |
| Get the next character.
|
int | put (int code) |
| Put the next character.
|
Additional Inherited Members |
virtual int | _getch (void)=0 |
| Get the next character.
|
virtual int | _putch (int code)=0 |
| Put the next character.
|
Detailed Description
Access standard files through character protocol.
This can also be used as an alternative means to access files that manages file pointers.
- Author
- David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org
Definition at line 657 of file fsys.h.
Constructor & Destructor Documentation
ucommon::charfile::charfile |
( |
FILE * |
file | ) |
|
|
inline |
Construct a charfile from an existing FILE pointer.
- Parameters
-
Definition at line 674 of file fsys.h.
ucommon::charfile::charfile |
( |
char * |
path, |
|
|
char * |
mode |
|
) |
| |
Construct an open charfile based on a path and mode.
- Parameters
-
path | of file to open. |
mode | of file. |
Member Function Documentation
void ucommon::charfile::open |
( |
char * |
path, |
|
|
char * |
mode |
|
) |
| |
Open file path.
If a file is already opened, it is closed.
- Parameters
-
path | of file to open. |
mode | of file to open. |
ucommon::charfile::operator bool |
( |
| ) |
|
|
inline |
Test if file is opened.
- Returns
- true if opened.
Definition at line 698 of file fsys.h.
bool ucommon::charfile::operator! |
( |
| ) |
|
|
inline |
Test if file is not opened.
- Returns
- true if not opened.
Definition at line 705 of file fsys.h.
size_t ucommon::charfile::put |
( |
char * |
string | ) |
|
Put a string into the file.
- Parameters
-
- Returns
- number of characters written.
size_t ucommon::charfile::readline |
( |
char * |
string, |
|
|
size_t |
size |
|
) |
| |
Read a line of input from the file.
This clears the newline character at the end and has consistent behavior with other ucommon file routines. Because the newline is cleared, the string length may be shorter than the return size.
- Parameters
-
string | to write. |
size | of buffer. |
- Returns
- true if data read, 0 if at end of file.
size_t ucommon::charfile::readline |
( |
string & |
string | ) |
|
Read a string of input from the file.
This clears the newline character at the end and has consistent behavior with other ucommon file routines. Because the newline is cleared, the string length may be shorter than the return size.
- Parameters
-
- Returns
- true if data read, 0 if at end of file.
The documentation for this class was generated from the following file: