For educational purposes i want to create a ostream and stream buffer to do A) fix endians when doing << myVar; B) store in a deque container instead of using std:cout or writing to a file C) log extra data, such as how many times i did <<, how many times i did .write, the amount of bytes i written and how many times i flush(). But i do not need all the info.
I tried overloading but failed horribly. i tried overloading write by doing ostream& write ( const char* s , streamsize n ) in my basic_stringstream2 class (i copied paste basic_stringstream into my cpp file and modified it) but the code kept using basic_ostream. I looked through code and it looks like i need to overload xsputn (which isnt mention on this page http://www.cplusplus.com/reference/iostream/ostream/ ) but what else do i need to overload? and how do i construct my class (what does it need to inherit, etc)?