LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Passing value from a terminal to a GTK text box (https://www.linuxquestions.org/questions/programming-9/passing-value-from-a-terminal-to-a-gtk-text-box-686354/)

geekbynature 11-26-2008 09:16 AM

Passing value from a terminal to a GTK text box
 
I've done some searching, and I just can't find anything to my satisfaction about this.

I have a program written in bash for balancing my checkbook. I started making a GUI for it, written in C, and ultimately I need to be able to read a value from the terminal (such as "echo foo", it would get "foo") and insert it into a text-entry box on the GUI.

I know how to get a string from one entry box and send it to another; as well as get a string from a box and send it to the terminal; but for the life of me I can't figure out how to do this.

MicahCarrick 11-26-2008 09:47 AM

Have a look at http://www.gtkforums.com/about906.html which shows how to run a terminal command and put the output (STDOUT) into a GtkTextView using the GLib function g_spawn_command_line_sync(). The concept is similar for other widgets like text boxes and there are other--more advanced methods if need be. You can read the manual on the g_spawn** functions.


All times are GMT -5. The time now is 06:40 AM.