Hi,
I am reading a binary file to string to update it and write it back again. When I add (append) user profiles in the binary file and read it again, every thing is oki because a null terminating character is generated after every user profile.

My problem is when I have for example 3 users and update the first one. When I update the first or second user profile, the null terminating character is removed and the rest of the contents are shifted backward ruining my data when read in binary mode again.

To update a user profile I am using this to modify my string:

Code:
buff.replace((rec*sizeof(sPlayer))-sizeof(sPlayer.szLastword), sizeof(sPlayer.szLastword), word.data());