Re: g_io_channel_read_to_end read just 998 chars, not more



As I talked later, my channel receives the output of a php script, in
those script I have:

echo "|" . utf8_encode($r) . "";

I have changed the utf8_encode to base64_encode and my channel don't
crash. What's the matter with utf8?

2010/5/28 frederico schardong <frede sch gmail com>:
> This is very strange. Yesterday I have got 998 characters from the
> g_io_channel_read_to_end, but today I have compiled with and without
> the if to show the error, but every time I'm getting 0 characters from
> the channel! I don't know what can cause it, because nothing has been
> changed unless the if.
>
> 2010/5/28 frederico schardong <frede sch gmail com>:
>> The error is:
>>
>> error: Canal termina num caractere parcial
>>
>> This means "Channel ending in a partial character".
>>
>> 2010/5/27 Robert Pearce <rob bdt-home demon co uk>:
>>> Hi frederico,
>>>
>>> On Thu, 27 May 2010 11:02:47 -0300 you wrote:
>>>> > Why don't you test the error returns?
>>>> GError *b = NULL;
>>>>
>>>> g_io_channel_read_to_end( channel, &string, &size, &b);
>>>>
>>>> g_print("returned: %s\nsize: %d\nerror: %s", string, size, b->message);
>>>>
>>>> It causes segmentation fault. What I'm doing wrong here?
>>>
>>> You're not testing the error return. If the g_io_channel_read_to_end completes without error, then it doesn't change 'b', so the printf is doing a de-reference of a NULL pointer. You should change it to :
>>>
>>> GError *b = NULL;
>>>
>>> g_io_channel_read_to_end( channel, &string, &size, &b);
>>>
>>> g_print("returned: %s\nsize: %d\n", string, size );
>>> if ( b )
>>>    g_print("error: %s\n", b->message);
>>> _______________________________________________
>>> gtk-list mailing list
>>> gtk-list gnome org
>>> http://mail.gnome.org/mailman/listinfo/gtk-list
>>>
>>
>>
>>
>> --
>> Thanks,
>> Frederico Schardong,
>> SOLIS - Open source solutions
>> www.solis.coop.br
>> Linux registered user #500582
>>
>
>
>
> --
> Thanks,
> Frederico Schardong,
> SOLIS - Open source solutions
> www.solis.coop.br
> Linux registered user #500582
>



-- 
Thanks,
Frederico Schardong,
SOLIS - Open source solutions
www.solis.coop.br
Linux registered user #500582


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