int sync();
Synchronizes the stream's internal buffer with the external source of characters. This function calls the virtual streambuf::sync function so you can customize its implementation by deriving a new class from streambuf.
EOF to indicate errors.