LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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: OpenSuse Tumbleweed
Posts: 131

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



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 / openSUSE 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

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:09 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration