Re: Open file from menu



Rudra Banerjee wrote:
1) putting the above block inside "if (argv[1] != "NULL")" is giving a
segmentation fault:

Are you checking argc? If you are not passing an argument argv[1] does
not exist so, yes, you will get a segfault for running beyond the argv[]
array.

if ( argc > 1 && argv[1] != NULL )
   foo
else
   return 0;

and 2) How I can open the file using file menu, instead of commandline
argument? I have defined the menu as follows:
[snip]
which is opening the file selector, but *NOT* writing it in the
textview. I wish to open the file in textview and save it aswell after I
edit that.

Are you checking for a filename returned from the file chooser dialog?
You are going to need more code to do what you want. GTK won't do it
automatically for you.



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