I'm using std:: ofstream, and I'm trying to open a file without truncation. I know of std::ios::app, but I'm trying to write to the beginning of the file and std::ios::app makes every output go to the end of the file (even with std:: ofstream::seekp( 0, std::ios::beg )). I've been Googling/board searching for a while, and I've found several "solutions" that don't work. Some say std::ios::ate doesn't truncate, but it does, and I've found plenty of similar things that do the same. So how do I go about opening a file for writing, with truncating it, and so I still have the ability to write to the beginning of the file?