Re: g_io_channel_read_to_end read just 998 chars, not more

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

 



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@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list


[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux