Re: gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(fs));

John Coppens <[email protected]> Thu, 5 Jun 2014 14:09:28 -0300
Newsgroups gmane.comp.gnome.glade.user
Message-ID <[email protected]>
On Tue, 03 Jun 2014 20:53:16 -0400
Ian Chapman <[email protected]> wrote:

>     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?  

How is fileselected declared? If as  char *fileselected, then you have to
allocate memory to fileselected first. It will work with a short string
like 1234, but not if the string is longer than 4 bytes or so. Remember
*fileselection is just a pointer - it doesn't have space yet. (you could
use strdup, which _does_ allocate memory ->  fileselected = strdup(...)

If defined as char fileselected[100] (or so) you might be exceeding
the [100] limit.

John
_______________________________________________
Glade-users maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/glade-users