共用方式為


basic_filebuf::overflow

Called when a new character is inserted into a full buffer.

virtual int_type overflow( 
   int_type _Meta = traits_type::eof 
);

Parameters

  • _Meta
    The character to insert into the buffer or traits_type::eof.

Return Value

If the function cannot succeed, it returns traits_type::eof. Otherwise, it returns traits_type::not_eof(_Meta).

Remarks

If _Meta != traits_type::eof, the protected virtual member function endeavors to insert the element ch = traits_type::to_char_type(_Meta) into the output buffer. It can do so in various ways:

  • If a write position is available, it can store the element into the write position and increment the next pointer for the output buffer.

  • It can make a write position available by allocating new or additional storage for the output buffer.

  • It can convert any pending output in the output buffer, followed by ch, by using the file conversion facet fac to call fac.out as needed. Each element ch of type char thus produced is written to the associated stream designated by the file pointer fp as if by successive calls of the form fputc(ch, fp). If any conversion or write fails, the function does not succeed.

Requirements

Header: <fstream>

Namespace: std

See Also

Reference

basic_filebuf Class

iostream Programming

iostreams Conventions