Hello,
I have 2 applications. One in C++ (windows) open a binary file and only reads from it, i use:
fstream m_fsDataIN.open("C:\TTT", ios::in | ios::binary | ios::app);
and the second application (is in C#) opens the file and writes to it. I use:
byte[] b = ... //have a binary data
System.IO.BinaryWriter bw = new System.IO.BinaryWriter(
System.IO.File.Open(@"C:\TTT",
System.IO.FileMode.Append,
System.IO.FileAccess.Write,
System.IO.FileShare.ReadWrite));
bw.Write(b);
bw.Flush();
bw.Close();
The problem is that the 8 first bytes are written incorrectly, comparing to what appears in the b
array.
When I open the file in the C# application, using System.IO.FileMode.Append
it works OK.
I checked in the application and it writes wrong 8 bytes.
I want to add that the first 8 bytes are 2 counters that each was created using IPAddressHostToNetworkAddress
.
I think that the problem is in the C++ application, in how I open the file.
Help, Thnaks