I need to save the path of each file contained in a folder. This is the code:
void on_file1_file_set(GtkFileChooserButton *chooser){
GSList filelist;
printf("file name = %s\n", gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(chooser)));
printf("folder uri = %s\n", gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(chooser)));
printf("folder filenames = %s\n", gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(chooser)));
return filelist;
}
and my error:
warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘GSList *’ {aka ‘struct _GSList *’} [-Wformat=]
The error is telling you that you are passing the wrong type of argument into the string formatter. In your third
printf()statement you are passing in the return value fromgtk_file_chooser_get_filenames()which is of typeGSList, notchar.All you need is to use the return value from that function. It is the GSList you are looking for.