CPallini has already described the main error.
It is also clearly stated in the documentation.
If you use the pointer returned by GetBuffer to change the string contents, you must call ReleaseBuffer to update the internal state of CSimpleStringT before you use any other CSimpleStringT methods.
I also miss the closing of the archive and the file
xycFile.Close();
ar.Close();
This is all the more important if you want to use the file and the archive with the same name each time.
However, I would also recommend separate names for both access directions.