Write string data to MemoryMappedFile

后端 未结 3 1926
不思量自难忘°
不思量自难忘° 2021-02-06 13:03

I am following this tutorial here

I am having a hard time figuring out how to get a string \"THIS IS A TEST MESSAGE\" to store in the memory mapped file and then pull it

3条回答
  •  醉话见心
    2021-02-06 13:47

    I used this to write the characters of a string:

    string contentString = "Hello";
    char[] charsToWrite = contentString.ToCharArray();
    accessor.WriteArray(0, charsToWrite, 0, charsToWrite.Length);
    

    This wrote wide characters. Both C# and C++ programs were able to read the data as wide characters.

提交回复
热议问题