Hi there! I've been trying to implement a database for a game I'm making, and I have a big problem.
My database has for content player profiles, which are appended to it has the game go along... the first two bytes in the database represent the number of profiles, and I'd like to update this number as the number of profiles increases.
I noticed that the only way to append content to a file without crushing it is to use the ios::app flag when opening the file... the problem is that when using ios::app, all output content is written at the end of the file... I've tried to write content at the beginning, but seekp(0, ios::beg) gets you to the end of the file, and tellp() gives a value of 0 there, even if it's at the end. I've tried putting a negative value if seekp(), to "go back" in the file, without success.
Does one of you guys have any idea how you can "change" the content of a file when it already has content?