LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 01-31-2013, 04:23 AM   #1
Mario Blunk
Member
 
Registered: Dec 2008
Location: Wild Eastern Germany
Distribution: Suse 9.x , 11.x, 12.1
Posts: 88

Rep: Reputation: 21
howto redirect command line to ada gtk.text_buffer ?


Hi friends,

currently I'm using this procedure in order to display the output of a command line program in an (ada) gtk.text buffer. After the program is launched (in this example /bin/ls), the output goes into a text file (see comment A). Finally the file content is sent to the text_buffer (see comment B).



procedure button_callback
(
widget : access gtk.widget.gtk_widget_record'class;
data : string_access
)
is
pragma unreferenced (widget);
begin
if data.all = "START" then
Create( result_file, Name => result_file_name);

-- launch external command
Spawn
(
Program_Name => "/bin/ls",
Args => ( 1=> new String'("-l")),
Output_File => result_file_name, -- comment A
Success => var_success,
Return_Code => Result
);

close(result_file);

-- comment B
-- display the file result_file_name in the text buffer
gtk.text_buffer.set_text (textbuf, read_result_file);

end button_callback;



The drawback is that I can't see the program output at runtime as it is required for the command line program "top" or the like.
What do I have to change ?

Thank you all !

Last edited by Mario Blunk; 01-31-2013 at 04:26 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Ada gtk on OpenSuse 12.x Mario Blunk Suse/Novell 2 01-29-2013 10:48 AM
[SOLVED] Howto run bash-built-in programs from inside a Ada-Program ? Mario Blunk Programming 7 10-15-2012 05:08 AM
How to redirect the command line output to the clipboard kejing Linux - Software 1 02-03-2009 12:21 AM
howto add a mouse on the command line? Fred Caro Linux - Newbie 4 12-29-2008 12:50 PM
pppd from command line...howto Crasherz Linux - Networking 1 03-05-2004 10:52 AM


All times are GMT -5. The time now is 01:22 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration