Re: g_io_channel_read_to_end read just 998 chars, not more
- From: frederico schardong <frede sch gmail com>
- To: Robert Pearce <rob bdt-home demon co uk>
- Cc: gtk-list gnome org
- Subject: Re: g_io_channel_read_to_end read just 998 chars, not more
- Date: Fri, 28 May 2010 07:59:38 -0300
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]