[Glade-users] gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(fs));

Ian Chapman ichapman at videotron.ca
Wed Jun 4 00:53:16 UTC 2014


void
on_filechooserwidget2_selection_changed(GtkFileChooser *fs) {
         printf("\n Selection changed. \n");
         char    *cName_pt;
         cName_pt = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(fs));
         printf("\n cName_pt =  %s .\n", cName_pt);    //Prints selected 
file okay.
//      strcpy(fileselected, cName_pt);    //This gives segment fault?
         strcpy(fileselected, test_pt);    //This works okay, test=1234 
passed to high level.
         return;
Hi All,
     I do not understand why I'm getting a segment fault from strcpy 
using cName_pt in the above code.  I can printf using cName_pt and it 
prints the file that I selected using the glade gtkfilechooserwidget.  I 
must be doing something silly, I hope that someone can see what it is?  
Regards Ian.


More information about the Glade-users mailing list