std::basic_ostream::sentry

class sentry; An object of class basic_ostream::sentry is constructed in local scope at the beginning of each member function of std::basic_ostream that performs output (both formatted and unformatted). Its constructor prepares the output stream: checks if the stream is already in a failed state, flushes the tie()'d output streams, and performs other implementation-defined tasks if necessary. Implementation-defined cleanup, as well as flushing of the output stream if necessary, is perfo

std::basic_ostream::write

basic_ostream& write( const char_type* s, std::streamsize count ); Behaves as an UnformattedOutputFunction. After constructing and checking the sentry object, outputs the characters from successive locations in the character array whose first element is pointed to by s. Characters are inserted into the output sequence until one of the following occurs: exactly count characters are inserted inserting into the output sequence fails (in which case setstate(badbit) is called) Pa

std::basic_ostream::seekp

basic_ostream& seekp( pos_type pos ); (1) basic_ostream& seekp( off_type off, std::ios_base::seekdir dir); (2) Sets the output position indicator of the current associated streambuf object. Behaves as UnformattedOutputFunction (except without actually performing output). After constructing and checking the sentry object, (since C++11) 1) sets the output position indicator to absolute (relative to the beginning of the file) value pos by calling rdbuf()->pubseekpos(p

std::basic_ostream::operator<<

basic_ostream& operator<<( short value ); basic_ostream& operator<<( unsigned short value ); (1) basic_ostream& operator<<( int value ); basic_ostream& operator<<( unsigned int value ); (2) basic_ostream& operator<<( long value ); basic_ostream& operator<<( unsigned long value ); (3) basic_ostream& operator<<( long long value ); basic_ostream& operator<<( unsigned long long value ); (4) (since

std::basic_ostream::basic_ostream

explicit basic_ostream( std::basic_streambuf<CharT, Traits>* sb ); (1) protected: basic_ostream( const basic_ostream& rhs ) = delete; (2) (since C++11) protected: basic_ostream( basic_ostream&& rhs ); (3) (since C++11) 1) Constructs the basic_ostream object, assigning initial values to the base class by calling basic_ios::init(sb). 2) The copy constructor is protected, and is deleted. Output streams are not copyable. 3) The move constructor uses basic_ios&l

std::basic_ostream::flush

basic_ostream& flush(); Writes uncommitted changes to the underlying output sequence. If rdbuf() is a null pointer, does nothing. Otherwise, behaves as an UnformattedOutputFunction (since C++11). After constructing and checking the sentry object, calls rdbuf()->pubsync(). If the call returns -1, calls setstate(badbit). Parameters (none). Return value *this. Exceptions May throw std::ios_base::failure if exceptions()&badbit!=0. Example #include <thread> #in

std::basic_ostream::put

basic_ostream& put( char_type ch ); Behaves as an UnformattedOutputFunction. After constructing and checking the sentry object, writes the character ch to the output stream. If the output fails for any reason, sets badbit. Parameters ch - character to write Return value *this. Notes This function is not overloaded for the types signed char or unsigned char, unlike the formatted operator<< Unlike formatted output functions, this function does not set the failbi

std::basic_ostream

Defined in header <ostream> template< class CharT, class Traits = std::char_traits<CharT> > class basic_ostream : virtual public std::basic_ios<CharT, Traits> The class template basic_ostream provides support for high level output operations on character streams. The supported operations include formatted output (e.g. integer values) and unformatted output (e.g. raw characters and character arrays). This functionality is implemented in terms of t

std::basic_ofstream::open

void open( const char *filename, ios_base::openmode mode = ios_base::out ); (1) void open( const std::string &filename, ios_base::openmode mode = ios_base::out ); (2) (since C++11) Opens and associates the file with name filename with the file stream. Calls setstate(failbit) on failure. Calls clear() on success. (since C++11) 1) Effectively calls rdbuf()->open(filename, mode | ios_base::out). (see std::basic_filebuf

std::basic_ofstream::is_open

bool is_open(); (until C++11) bool is_open() const; (since C++11) Checks if the file stream has an associated file. Effectively calls rdbuf()->is_open(). Parameters (none). Return value true if the file stream has an associated file, false otherwise. Example See also open opens a file and associates it with the stream (public member function) close closes the associated file (public member function)