combo widget list
- From: Chris De Maeyer <chrisdm pandora be>
- To: gtk-app-devel-list gnome org
- Subject: combo widget list
- Date: Mon, 08 Dec 2003 19:57:21 +0100
Trying to fill a combo box widget with labels from a file, find the
error? The first part of the line is extracted as label.
int fgk_ReadAircrafts(char *flyfile)
{
FILE *tmp;
char str[64];
char *ipos;
char token[32];
GString *tok;
if((tmp=fopen(flyfile,"r"))!=NULL) {
while(!feof(tmp)) {
fgets(str,sizeof(str)-1,tmp);
ipos=strchr(str,' ');
if (ipos!=NULL) {
strncpy(token,str,ipos-str);
token[ipos-str]=0;
tok = g_string_new(token);
combo_aircraft_list=g_list_append (combo_aircraft_list, tok);
}
}
fclose(tmp);
} else {
return(-1);
}
return(0);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]