On Mon, 2007-01-22 at 19:56 +0100, Olivier Ramare wrote:

> Many thanks to all, my handling of files and strings
> was in fact faulty. I used
> 
> while(fp != NULL){
>   fgets(line ,256, fp);
>   gtk_text_buffer_insert_at_cursor(...);}
> 
> which results in the last line being read twice,
> with wrong charaters at the beginning the second time.
> An eof character most probably somewhere.
> 
> The test !feof(fp) is no better, but the easy
> and clean code :
> 
> while( fgets(line ,256, fp)!= NULL){
>   gtk_text_buffer_insert_at_cursor(...);}
> 


Olivier,
If you use glib at all, you might want to try this api for the text file
io.

gboolean    g_file_get_contents (const gchar *filename,

                          gchar **contents,
                          gsize *length,
                          GError **error);

James,

> does wonder. I promise, next time I'll
> check my code more thoroughly before
> incriminating gtk!
> 
> Best,
> Amities,
>                Olivier
> 
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

James Scott, Jr.                                                 
Registered Linux User #270764
FC6 on Dual AMD-MP 2400+
Author: {gfhcm, gkrellfah2,gapcmon,giw}.sourceforge.net
http://mysite.verizon.net/skoona/index.html
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to