The function sputc() returns traits_type::eof() in case of an error, where traits_type
is a type definition in the class basic_streambuf. The function sputn() writes the number of characters specified by the second argument unless the stream buffer cannot consume them. It does
not care about (terminating) null characters. This function returns the number of characters written.