Encoding.Unicode string storage format

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello,
I have a c++ application in which i want to generate a Encoding.Unicode file which can be read by a C# application.
As i understand, unicode string length precedes the string. i need help in determining the format of string length bytes.
<span style="font-size:x-small
255 character string (00 FF) is written as FE 30 following by 255 unicode characters.
<span style="font-size:x-small My question is how is 0x00ff transformed to FE 30
<font size="2" style="font-size:x-small
<span style="font-size:x-small <span style="font-size:x-small TIA
</font>



BinaryWriter binWriter = new BinaryWriter(File.Open(@"c:Test.bin", FileMode.CreateNew, FileAccess.Write), Encoding.Unicode);<br/>
<br/>
binWriter.Write("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");<br/>
binWriter.Write("ABC");<br/>
binWriter.Close();

View the full article
 
Back
Top