Hello, I am a beginner who has become very confused.
I have a data file and can transfer it to a GList which I can then print out. Can anyone help me display the complete GList in a gtk+ list box? My test program to load a GList and then print it out: #include <glib.h> #include <stdio.h> /***** FUNC TO DISPLAY GList *****/ void PrintList( GList *list ) { list = g_list_first( list ); while( list != NULL ) { g_print( "%s", (gchar *)list -> data ); list = g_list_next( list ); } } gint main( ) { GList *list = NULL; FILE *infile; gchar buffer[5][81]; gint i = 0; /***** OPEN DATA FILE *****/ if( ( infile = fopen( "/home/jim/gnome/data.dat", "r" )) == NULL ) { g_print( "\nfopen() failed!\n" ); exit( 0 ); } /***** LOAD BUFFER WITH DATA *****/ while( ( fgets( buffer[i], 81, infile ) ) != NULL ) { i++; } /***** ADD BUFFER DATA TO GList *****/ for( i = 0; i < 5; i++ ) { list = g_list_append( list, buffer[i] ); } PrintList( list ); g_list_free( list ); fclose( infile ); return 0; } thank you, jim, [EMAIL PROTECTED] __________________________________________________ Do You Yahoo!? Send FREE Valentine eCards with Yahoo! Greetings! http://greetings.yahoo.com _______________________________________________ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list