Re: Coding systems ?
- From: James Scott Jr <skoona verizon net>
- To: Olivier Ramare <Olivier Ramare univ-lille1 fr>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Coding systems ?
- Date: Mon, 22 Jan 2007 23:47:12 -0500
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]