libstdc++
|
Provides a layer of compatibility for C/POSIX.
This GNU extension provides extensions for working with standard C FILE*'s and POSIX file descriptors. It must be instantiated by the user with the type of character used in the file stream, e.g., stdio_filebuf<char>.
__gnu_cxx::stdio_filebuf::stdio_filebuf | ( | ) | [inline] |
deferred initialization
Definition at line 66 of file stdio_filebuf.h.
__gnu_cxx::stdio_filebuf::stdio_filebuf | ( | int | __fd, |
std::ios_base::openmode | __mode, | ||
size_t | __size = static_cast<size_t>(BUFSIZ) |
||
) |
fd | An open file descriptor. |
mode | Same meaning as in a standard filebuf. |
size | Optimal or preferred size of internal buffer, in chars. |
This constructor associates a file stream buffer with an open POSIX file descriptor. The file descriptor will be automatically closed when the stdio_filebuf is closed/destroyed.
Definition at line 128 of file stdio_filebuf.h.
__gnu_cxx::stdio_filebuf::stdio_filebuf | ( | std::__c_file * | __f, |
std::ios_base::openmode | __mode, | ||
size_t | __size = static_cast<size_t>(BUFSIZ) |
||
) |
f | An open FILE* . |
mode | Same meaning as in a standard filebuf. |
size | Optimal or preferred size of internal buffer, in chars. Defaults to system's BUFSIZ . |
This constructor associates a file stream buffer with an open C FILE*
. The FILE*
will not be automatically closed when the stdio_filebuf is closed/destroyed.
Definition at line 144 of file stdio_filebuf.h.
__gnu_cxx::stdio_filebuf::~stdio_filebuf | ( | ) | [virtual] |
Closes the external data stream if the file descriptor constructor was used.
Definition at line 123 of file stdio_filebuf.h.
void std::basic_filebuf::_M_create_pback | ( | ) | [inline, protected, inherited] |
void std::basic_filebuf::_M_destroy_pback | ( | ) | throw () [inline, protected, inherited] |
void std::basic_filebuf::_M_set_buffer | ( | streamsize | __off | ) | [inline, protected, inherited] |
This function sets the pointers of the internal buffer, both get and put areas. Typically:
__off == egptr() - eback() upon underflow/uflow (read mode); __off == 0 upon overflow (write mode); __off == -1 upon open, setbuf, seekoff/pos (uncommitted mode).
NB: epptr() - pbase() == _M_buf_size - 1, since _M_buf_size reflects the actual allocated memory and the last cell is reserved for the overflow char of a full put area.
__filebuf_type* std::basic_filebuf::close | ( | ) | [inherited] |
Closes the currently associated file.
this
on success, NULL on failureIf no file is currently open, this function immediately fails.
If a put buffer area exists, overflow(eof)
is called to flush all the characters. The file is then closed.
If any operations fail, this function also fails.
int __gnu_cxx::stdio_filebuf::fd | ( | ) | [inline] |
Once associated with an external data stream, this function can be used to access the underlying POSIX file descriptor. Note that there is no way for the library to track what you do with the descriptor, so be careful.
Definition at line 109 of file stdio_filebuf.h.
std::__c_file* __gnu_cxx::stdio_filebuf::file | ( | ) | [inline] |
This function can be used to access the underlying "C" file pointer. Note that there is no way for the library to track what you do with the file, so be careful.
Definition at line 119 of file stdio_filebuf.h.
bool std::basic_filebuf::is_open | ( | ) | const throw () [inline, inherited] |
__filebuf_type* std::basic_filebuf::open | ( | const char * | __s, |
ios_base::openmode | __mode | ||
) | [inherited] |
Opens an external file.
s | The name of the file. |
mode | The open mode flags. |
this
on success, NULL on failureIf a file is already open, this function immediately fails. Otherwise it tries to open the file named s using the flags given in mode.
Table 92, adapted here, gives the relation between openmode combinations and the equivalent fopen() flags. (NB: lines app, in|out|app, in|app, binary|app, binary|in|out|app, and binary|in|app per DR 596) +---------------------------------------------------------+ | ios_base Flag combination stdio equivalent | |binary in out trunc app | +---------------------------------------------------------+ | + w | | + + a | | + a | | + + w | | + r | | + + r+ | | + + + w+ | | + + + a+ | | + + a+ | +---------------------------------------------------------+ | + + wb | | + + + ab | | + + ab | | + + + wb | | + + rb | | + + + r+b | | + + + + w+b | | + + + + a+b | | + + + a+b | +---------------------------------------------------------+
__filebuf_type* std::basic_filebuf::open | ( | const std::string & | __s, |
ios_base::openmode | __mode | ||
) | [inline, inherited] |
virtual __streambuf_type* std::basic_filebuf::setbuf | ( | char_type * | __s, |
streamsize | __n | ||
) | [protected, virtual, inherited] |
Manipulates the buffer.
s | Pointer to a buffer area. |
n | Size of s. |
this
If no file has been opened, and both s and n are zero, then the stream becomes unbuffered. Otherwise, s
is used as a buffer; see http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch25s02.html for more.
char_type* std::basic_filebuf::_M_buf [protected, inherited] |
size_t std::basic_filebuf::_M_buf_size [protected, inherited] |
char* std::basic_filebuf::_M_ext_buf [protected, inherited] |
streamsize std::basic_filebuf::_M_ext_buf_size [protected, inherited] |
const char* std::basic_filebuf::_M_ext_next [protected, inherited] |
ios_base::openmode std::basic_filebuf::_M_mode [protected, inherited] |
char_type std::basic_filebuf::_M_pback [protected, inherited] |
char_type* std::basic_filebuf::_M_pback_cur_save [protected, inherited] |
char_type* std::basic_filebuf::_M_pback_end_save [protected, inherited] |
bool std::basic_filebuf::_M_pback_init [protected, inherited] |
bool std::basic_filebuf::_M_reading [protected, inherited] |