std::basic_ios::imbue

std::locale imbue( const std::locale& loc ); Replaces the current locale. Effectively calls ios_base::imbue(loc) and if there is an associated stream buffer (rdbuf() != 0), then calls rdbuf()->pubimbue(loc). Parameters loc - the new locale Return value The previous locale, as returned by ios_base::imbue(loc). Exceptions (none). Example #include <iostream> #include <sstream> #include <locale> int main() { std::istringstream iss; is

std::basic_ios::fill

CharT fill() const; (1) CharT fill( CharT ch ); (2) Manages the fill character used to pad the output conversions to the specified field width. 1) returns the current fill character 2) sets the fill character to ch, returns previous value of the fill character Parameters ch - the character to use as fill character Return value the fill character before the call to the function. Example #include <iostream> #include <iomanip> int main () { std::

std::basic_ios::good

bool good() const; Returns true if the the most recent I/O operation on the stream completed successfully. Specifically, returns result of rdstate() == 0. See ios_base::iostate for the list of conditions that set the stream status bits. Parameters (none). Return value true if the stream has no errors occurred, false otherwise. Example See also The following table shows the value of basic_ios accessors (good(), fail(), etc.) for all possible combinations of ios_base::iostate

std::basic_ios::init

protected: void init( std::basic_streambuf<CharT,Traits>* sb ); Sets the associated stream buffer to sb and initializes the internal state. The postconditions are as follows: Element Value rdbuf() sb tie() NULL rdstate() goodbit if sb is not NULL, otherwise badbit exceptions() goodbit flags() skipws | dec width() ​0​ precision() 6 fill() widen(' ') getloc() a copy of the value returned by std::locale() This member function is protected: it

std::basic_ios::eof

bool eof() const; Returns true if the associated stream has reached end-of-file. Specifically, returns true if eofbit is set in rdstate(). See ios_base::iostate for the list of conditions that set eofbit. Parameters (none). Return value true if an end-of-file has occurred, false otherwise. Notes This function only reports the stream state as set by the most recent I/O operation; it does not examine the associated data source. For example, if the most recent I/O was a get(), whi

std::basic_ios::copyfmt

basic_ios& copyfmt(const basic_ios& other); Copies the state of the stream other into *this. This is done in the following sequence: 1) Calls every callback registered by register_callback() passing erase_event as parameter 2) Copies all member objects from other to *this except for rdstate(), the exception mask, and rdbuf(). In particular, makes copies of the locale, the formatting flags, the contents of the arrays std::ios_base::iword and std::ios_base::pword (but not the iw

std::basic_ios::exceptions

std::ios_base::iostate exceptions() const; (1) void exceptions( std::ios_base::iostate except ); (2) Gets and sets the exception mask of the stream. The exception mask determines the error states, on occurrence of which the stream throws exception of type failure. 1) Returns the exception mask. 2) Sets the exception mask to except. Parameters except - exception mask Return value 1) The current exception mask. 2) (none) Example #include <iostream> #incl

std::basic_ios::fail

bool fail() const; Returns true if an error has occurred on the associated stream. Specifically, returns true if badbit or failbit is set in rdstate(). See ios_base::iostate for the list of conditions that set failbit or badbit. Parameters (none). Return value true if an error has occurred, false otherwise. Example #include <iostream> #include <fstream> #include <cstdlib> int main() { std::ifstream file("test.txt"); if(!file) // operator! is used he

std::basic_ios::clear

void clear( std::ios_base::iostate state = std::ios_base::goodbit ); Clears the stream error state flags by assigning them the value of state. If rdbuf() == 0 then state | badbit is assigned. May throw an exception. Parameters state - new error state flags setting. It can be a combination of the following constants: Constant Explanation goodbit no error badbit irrecoverable stream error failbit input/output operation failed (formatting or extraction error) eofbi

std::basic_ios

Defined in header <ios> template< class CharT, class Traits = std::char_traits<CharT> > class basic_ios : public ios_base The class std::basic_ios provides facilities for interfacing with objects that have std::basic_streambuf interface. Several std::basic_ios objects can refer to one actual std::basic_streambuf object. Inheritance diagram. Two specializations for common character types are also provided: Type Definition ios basic_ios<c