The code in streambuf.tcc for xsputn requires the output from underflow(__c) to be __c to indicate no error;however, the standard, I believe, only requires the output to be something other than traits::eof().