Author Topic: a simple string problem  (Read 9771 times)

bek

  • Not-a-newbie
  • *
  • Posts: 7
  • Karma: 0
    • View Profile
a simple string problem
« on: April 02, 2012, 11:15:50 AM »
hello,

i have a simple problem with serialization / deserialization of string between c++ and c# (others things just run fine)
on c++ side i do

RakNet::RakString::SerializeCompressed(pData,pStream);
with pData = char* and pStream a BitStream

on the c# :
bool rsult =  RakString.DeserializeCompressed(str, stream);

rsult is true, but my str is empty and i don't know why :/
I've tried using stringcompressor, but i did not found the function on my generated c#
I've also tried to serialize the length of string to somehow allocate the c# str, but same result.

Anyone can point where i did wrong please ? :x

Rak'kar

  • Administrator
  • Hero Member
  • *****
  • Posts: 6895
  • Karma: 291
    • View Profile
    • RakNet
Re: a simple string problem
« Reply #1 on: April 02, 2012, 09:36:05 PM »
Try using RakString directly. On C++:
RakString rs;
rs = "blah;
BitStream bs;
bs.WriteCompressed(rs);

Do something similar in C#

bek

  • Not-a-newbie
  • *
  • Posts: 7
  • Karma: 0
    • View Profile
Re: a simple string problem
« Reply #2 on: April 03, 2012, 02:29:04 AM »
thanks a lot :)
it's working writing and reading with rakstring directly.

NeptuneX

  • Guest
Re: a simple string problem
« Reply #3 on: April 26, 2012, 12:41:13 AM »
C# use unicode inside,its "char" equal to "wchat_t" in C++.so their will be lot of implicit conversion