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: 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, filestat.st_size); free(buffer); But I am facing 2 problem(2nd problem is more important to solve). 1) putting the above block inside "if (argv[1] != "NULL")" is giving a segmentation fault: [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Program received signal SIGSEGV, Segmentation fault. 0x000000364066c81e in fread () from /lib64/libc.so.6 and 2) How I can open the file using file menu, instead of commandline argument? I have defined the menu as follows: file = gtk_menu_item_new_with_mnemonic("_File"); new = gtk_image_menu_item_new_from_stock(GTK_STOCK_NEW, accel_group); open = gtk_image_menu_item_new_from_stock(GTK_STOCK_OPEN, accel_group); sep = gtk_separator_menu_item_new(); quit = gtk_image_menu_item_new_from_stock(GTK_STOCK_QUIT, accel_group); gtk_menu_item_set_submenu(GTK_MENU_ITEM(file), filemenu); gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), new); gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), open); gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), sep); gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), quit); gtk_menu_shell_append(GTK_MENU_SHELL(menubar), file); gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, FALSE, 3); g_signal_connect(G_OBJECT(new), "activate", G_CALLBACK(filenew_activated), (gpointer) window); g_signal_connect(G_OBJECT(open), "activate", G_CALLBACK(fileopen_activated), (gpointer) window); g_signal_connect_swapped(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL); g_signal_connect(G_OBJECT(quit), "activate", G_CALLBACK(gtk_main_quit), NULL); 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. If anyone kindly show the how-to, I can put problem (1) to solve later. Please help. _____________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list