The extraction and insertion operators for fstream only read/write from/to disk in human readable text form. I would like to override them so that when I set the flag to binary, the operators would work like a binary read or write would. I realize for structures I would use read and write, but to simply write single values read and write are a pain in the arse.
How would I go about overloading << and >> relative to fstream binary mode? My guess is I probably need to derive from fstream and use basic_streambuf's protected buffer function members to extract/insert the data in binary mode?
Any help would be appreciated.