Combo question
- From: "cybernick gmx net" <cybernick gmx net>
- To: gtk-app-devel-list gnome org
- Subject: Combo question
- Date: Thu, 27 Apr 2006 19:24:04 +0200
Hi,
I'm pretty frustrated because I can't solve this by myself. Can you help
me?
I have a file that looks like
1 Adam
1 Bert
1 Daniel
2 Marc
2 Sam
..
..
9 Zack
and so on. That's an int number, a blank and a name. My code looks like this snip ...
GList *glist = NULL;
FILE *fp;
if ( ! ( fp = fopen(filename, "r")))
{
fprintf(stderr, "Errror in opening data file %s: error: %s\n", filename, strerror(errno));
}
else
{
while (fscanf(fp, "%i %s", f_i, f_c) != EOF)
{
if ( f_i == 1 )
{
fprintf(stderr, "f_i: %i;\tadding: %s\n", f_i, f_c);
/* everything correct up to here */
glist = g_list_append(glist, f_c);
}
}
fclose(fp);
}
gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist);
g_list_free(glist);
The output from the fprintf is absolutely correct. In the combo I have
the correct number of entries but all of them are 'Zack'. What's wrong
with my code? I had a look at this for several hours and I googled a
long time but I don't find it.
Please help me. I really appreciate your help.
Thank you in advance
Regards
--
cybernick gmx net <cybernick gmx net>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]