Re: Avoiding string break...



2010/5/3 michi7x7 <mailing-lists michi7x7 de>:
> ----- Original Message ----
>>>
>>> Does exist any foreseen solution to avoid the classical string break
>>> by the '\0' character ?
>>>
>>> (I use Gio::receive&  Gio::send()...)
>>>
>>> Glus
>>>
>
> If you use a std::string the string should be able to contain '\0'.
>
> For example:
>
> Gio::IOStream io_stream;
> Glib::RefPtr<Gio::Outputstream> out = io_stream->get_output_stream();
> std::string str("ABC\0DEF");
> out->send(str);
>
> But I'm not sure about that...

Excuse-me, I'm using Gio::Socket::receive() & Gio::Socket::send(), not
Gio::receive() & Gio::send()...

Both Gio::Socket::receive() & Gio::Socket::send() take as a chain
types "char *" and  "const gchar *" values, respectively, but not
std::string (right now, I get the values using the c_str() method...)

The tests done show me that in most cases all works fine, but sometimes, when

"subchain1\0subchain2"

only retrive "subchain1"..

Glus


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]