hi,
I am reading a file to string to update the file and write the string back again. After I try to add another 'user profile' to my binary file (append mode). When I try to update the user record before the one just added, I noticed from debugging, that my program is adding a '0' after the entry which is updated, ruining all my data when read in binary mode, since I have a shift. I cannot play around with my position because, this is happening only when updating not when adding new entries one after the other. I there a way I can remove this '0'?
I realized now that, when adding the user profiles one after the other in the text file by flushing a string, I have these '0' at the end of each profile. But when there already say 3 profiles in the string and I update the first, the '0' is removed and therefore the rest of the data is shifted.
I need to find a way to keep the '0' at the end even when I update a single profile from many in the string.
Okay it's the null terminating character :) .. but is there a way to enable/disable it when writing into a file, or when updating a string or disable it if there is already a null?