void parseChannels( FILE *fi ) { int parsing = 0, i = 0, firstW = 0, firstP = 0; char ch, s[500], strout[550]; while( parsing == 0 ) { ch = fgetc( fi ); // Read in the next character if( (ch != ':') && (firstW == 0) ) { s[i] = ch; i++; } else { if(( ch == ':' ) && ( firstP == 0 )) { s[i] = '\0'; strcpy( strout, "dvb://" ); strcat( strout, s); // printf("%s\n", strout); prints output add_item_to_playlist( strout, 0 ); //add to playlist i = 0; firstW++; firstP++; } if( ch == '\n' ) { firstW = 0; firstP = 0; } } } //END while } //END parseChannels void menuitem_open_dtv_callback(GtkMenuItem * menuitem, void *data) { gtk_list_store_clear(playliststore); gtk_list_store_clear(nonrandomplayliststore); FILE *fi; // FILE pointer to use to open the conf file gchar *mpconf; mpconf = g_strdup_printf("%s/.mplayer/config", getenv("HOME")); fi = fopen( mpconf, "r"); // Make sure this is pointing to // the appropriate file parseChannels( fi ); gtk_tree_model_get_iter_first(GTK_TREE_MODEL(playliststore),&iter); play_file("dvb://", 0); }