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 <[email protected]>:
> The error is:
>
> error: Canal termina num caractere parcial
>
> This means "Channel ending in a partial character".
>
> 2010/5/27 Robert Pearce <[email protected]>:
>> 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
>> [email protected]
>> 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
_______________________________________________
gtk-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to