Re: read() and label funkiness



"Ben K" <kynneb@hotmail.com> writes: 
>     pppd_fd = open ("/etc/ppp/pppd.status", O_RDONLY); //get the fd
>     read(pppd_fd, label_text_ptr, 25);//read 25 bytes
>     gtk_label_set_text(GTK_LABEL( (GtkWidget*)data ), label_text_ptr);

read() isn't going to nul-terminate your string. Use calloc() or
g_malloc0() instead of malloc(). (Remember to use g_free() if you use
g_malloc0()).

Havoc




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