Re: Open file from menu

2012-07-09 Thread Rudra Banerjee
Will anyone kindly show the way? -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. Rudra Banerjee bnrj.ru...@yahoo.com wrote: Dear friends, I am trying to create a textview that will show the file opens. I have managed to make it read the commandline argument as:

Re: Open file from menu

2012-07-09 Thread Michael Cronenworth
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 )

Re: Open file from menu

2012-07-09 Thread Liam R E Quin
On Tue, 2012-07-10 at 00:55 +0530, Rudra Banerjee wrote: Will anyone kindly show the way? stat(argv[1], filestat); buffer = (char *) malloc(filestat.st_size * sizeof (char)); efile = fopen(argv[1], r); fread(buffer, filestat.st_size, 1, efile); gtk_text_buffer_set_text(textbuffer, buffer,

Re: Open file from menu

2012-07-09 Thread David Nečas
On Mon, Jul 09, 2012 at 03:40:11PM -0400, Liam R E Quin wrote: also check that the free() was OK I wonder how you do that (apart from not getting any glibc MALLOC_CHECK_ error message or similar). Yeti ___ gtk-app-devel-list mailing list

Re: Open file from menu

2012-07-09 Thread Liam R E Quin
On Mon, 2012-07-09 at 22:01 +0200, David Nečas wrote: On Mon, Jul 09, 2012 at 03:40:11PM -0400, Liam R E Quin wrote: also check that the free() was OK I wonder how you do that (apart from not getting any glibc MALLOC_CHECK_ error message or similar). There's no portable way to do it