Ok, except the sgetc change, don't do this. Also, your line breaks are funny: + const bool __testeof = + traits_type::eq_int_type(__c, traits_type::eof()); Should be: + const bool __testeof = traits_type::eq_int_type(__c, + traits_type::eof()); -benjamin