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




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.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]