1

I'm saving some data in a .txt file so I can load/read it after, but some special characters do not work well.

I took a screenshot how it looks "inside" the string, because it saves some symbols in the file and when I load it doesn't load as it is suppose to.

Image with the characteres and how they are show in the string:

enter image description here

I'm using the WinAPI code to write and read the file: WritePrivateProfileString() and GetPrivateProfileString()

public static void FileWriteValue(string File, string Section, string Key, string Value)
        {
            WritePrivateProfileString(Section, Key, Value, File);
        }

        public static string FileReadValue(string File, string Section, string Key)
        {
            StringBuilder temp = new StringBuilder(100000);
            int i = GetPrivateProfileString(Section, Key, "", temp, 100000, File);
            return temp.ToString();
        }

Upddated with the Write and Read.

4

0 回答 0