G
Guest
Hi,
I have a windows C# app which read data through socket from a C++ app in a
linux box. After a marshal a pointer and get an array of string ends with \0,
I did something like this
string s=new string(array);
s = s.Replace("\0","");
if(s == "ABC")
success
else
fail
However, if I did it in my test all in C#, it works. If I plug into the
production and start to listen to the linux box messages, it always fail. If
Studio's output window, I can see s becomes ABC~ instead of ABC.
Does anyone here know what is the most efficient way to solve this problem?
I do can iterate the array to detect \0, but I do want the most efficient way
since I am facing a very heavy traffic from that linux box.
Thanks a lot
Chris
I have a windows C# app which read data through socket from a C++ app in a
linux box. After a marshal a pointer and get an array of string ends with \0,
I did something like this
string s=new string(array);
s = s.Replace("\0","");
if(s == "ABC")
success
else
fail
However, if I did it in my test all in C#, it works. If I plug into the
production and start to listen to the linux box messages, it always fail. If
Studio's output window, I can see s becomes ABC~ instead of ABC.
Does anyone here know what is the most efficient way to solve this problem?
I do can iterate the array to detect \0, but I do want the most efficient way
since I am facing a very heavy traffic from that linux box.
Thanks a lot
Chris