comp.lang.ada
 help / color / mirror / Atom feed
* Getting Information already displayed on terminal window
@ 2002-04-17 23:09 Fraz
  2002-04-18  8:51 ` Peter Hermann
  2002-04-19  7:06 ` Alfred Hilscher
  0 siblings, 2 replies; 7+ messages in thread
From: Fraz @ 2002-04-17 23:09 UTC (permalink / raw)


I notice that Ada Gide has an option which redirects the output to a file if
desired.  How do i build this into my program?

I am executing an external program and want to read in the result of this
from the output screen - can i??

Cheers

Fraz





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Getting Information already displayed on terminal window
  2002-04-17 23:09 Getting Information already displayed on terminal window Fraz
@ 2002-04-18  8:51 ` Peter Hermann
  2002-04-18 11:32   ` Fraz
  2002-04-18 19:07   ` Stephen Leake
  2002-04-19  7:06 ` Alfred Hilscher
  1 sibling, 2 replies; 7+ messages in thread
From: Peter Hermann @ 2002-04-18  8:51 UTC (permalink / raw)


Fraz <fraz@totalise.co.uk> wrote:
> I notice that Ada Gide has an option which redirects the output to a file if
> desired.  How do i build this into my program?

In AdaGIDE, the "standard output"(!) can be redirected to a file.
you set the "run options" to one the following choices:
    -- output to screen
    -- output to file
    -- both

-- 
--Peter Hermann(49)0711-685-3611 fax3758 ica2ph@csv.ica.uni-stuttgart.de
--Pfaffenwaldring 27 Raum 114, D-70569 Stuttgart Uni Computeranwendungen
--http://www.csv.ica.uni-stuttgart.de/homes/ph/
--Team Ada: "C'mon people let the world begin" (Paul McCartney)



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Getting Information already displayed on terminal window
  2002-04-18  8:51 ` Peter Hermann
@ 2002-04-18 11:32   ` Fraz
  2002-04-18 13:58     ` Mark Johnson
  2002-04-18 19:07   ` Stephen Leake
  1 sibling, 1 reply; 7+ messages in thread
From: Fraz @ 2002-04-18 11:32 UTC (permalink / raw)


yeah i know, but there must be a way to build this into the program so that
if i run the exe outside of ada gide it creates the file as well??

Fraz

"Peter Hermann" <ica2ph@iris16.csv.ica.uni-stuttgart.de> wrote in message
news:a9m1f7$f0i$2@news.uni-stuttgart.de...
> Fraz <fraz@totalise.co.uk> wrote:
> > I notice that Ada Gide has an option which redirects the output to a
file if
> > desired.  How do i build this into my program?
>
> In AdaGIDE, the "standard output"(!) can be redirected to a file.
> you set the "run options" to one the following choices:
>     -- output to screen
>     -- output to file
>     -- both
>
> --
> --Peter Hermann(49)0711-685-3611 fax3758 ica2ph@csv.ica.uni-stuttgart.de
> --Pfaffenwaldring 27 Raum 114, D-70569 Stuttgart Uni Computeranwendungen
> --http://www.csv.ica.uni-stuttgart.de/homes/ph/
> --Team Ada: "C'mon people let the world begin" (Paul McCartney)





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Getting Information already displayed on terminal window
  2002-04-18 11:32   ` Fraz
@ 2002-04-18 13:58     ` Mark Johnson
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Johnson @ 2002-04-18 13:58 UTC (permalink / raw)


Fraz wrote:
> 
> yeah i know, but there must be a way to build this into the program so that
> if i run the exe outside of ada gide it creates the file as well??
> 
On unix, you could "tee" the output (and errors...) to display and
capture into a file. Since you said "exe" though you might be on Windows
& I don't know the equivalent (other than to copy & paste from the
terminal window - extend the history buffer if needed).

Otherwise, if you had the discipline to not call text_io & friends
directly, you could have a package with the same interface as text_io
that does what you want. Retrofitting this into existing code is
drudgery - from past experience....
  --Mark



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Getting Information already displayed on terminal window
  2002-04-18  8:51 ` Peter Hermann
  2002-04-18 11:32   ` Fraz
@ 2002-04-18 19:07   ` Stephen Leake
  1 sibling, 0 replies; 7+ messages in thread
From: Stephen Leake @ 2002-04-18 19:07 UTC (permalink / raw)


Peter Hermann <ica2ph@iris16.csv.ica.uni-stuttgart.de> writes:

> Fraz <fraz@totalise.co.uk> wrote:
> > I notice that Ada Gide has an option which redirects the output to
> > a file if desired. How do i build this into my program?

The output functions in Ada.Text_IO come in two forms:

procedure Put_Line (File : in File_Type; Item : in String);
procedure Put_Line (Item : in String);

The first form takes an explicit file to output to, the second goes to
Ada.Text_IO.Current_Output. 

Ada.Text_IO.Current_Output defaults to "standard output", but you can
set it to any other valid file.

So you have two options; you can write your code to use explicit
files, or you can set Ada.Text_IO.Current_Output at the beginning of
your program, possibly based on a command line argument.

If you use explicit files, you should consider passing the file name
as a command line argument.

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Getting Information already displayed on terminal window
@ 2002-04-18 22:04 Gautier Write-only-address
  0 siblings, 0 replies; 7+ messages in thread
From: Gautier Write-only-address @ 2002-04-18 22:04 UTC (permalink / raw)


"Peter Hermann":

> > In AdaGIDE, the "standard output"(!) can be redirected to a file.
> > you set the "run options" to one the following choices:
> >     -- output to screen
> >     -- output to file
> >     -- both

"Fraz":
>yeah i know, but there must be a way to build this into the
>program so that if i run the exe outside of ada gide it creates
>the file as well??

To obtain simultaneously the output on "standard output" and
a file the best way is to use Dual_IO whose interface mimicks
[Ada.]Text_IO (83 and 95 versions) but has the desired effect.
I use it e.g. on the same program under OpenVMS and Windows.
See paqs.zip @

  http://www.mysunrise.ch/users/gdm/gsoft.htm

HTH
____________________________________________________________
Gautier  --  http://www.mysunrise.ch/users/gdm/index.htm#Ada

NB: For a direct answer, address on the Web site!



_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Getting Information already displayed on terminal window
  2002-04-17 23:09 Getting Information already displayed on terminal window Fraz
  2002-04-18  8:51 ` Peter Hermann
@ 2002-04-19  7:06 ` Alfred Hilscher
  1 sibling, 0 replies; 7+ messages in thread
From: Alfred Hilscher @ 2002-04-19  7:06 UTC (permalink / raw)




Fraz wrote:
> 
> I notice that Ada Gide has an option which redirects the output to a file if
> desired.  How do i build this into my program?
> 
> I am executing an external program and want to read in the result of this
> from the output screen - can i??
> 
> Cheers
> 
> Fraz


Hi,

what exactly want you do, start another program from your own program
and catching its output, or simply start your program and write the
output to a file?

(I assume that you use widows as you mentioned AdaGide which is a
windows tool)

The later can be done by simply redirecting output as under Unix via ">"
(tested with NT 4.0)
e.g. MY_PROG > file.out 2> file.err

The first one can be done with anonymous pipes. For an example, download
the AdaGide sources and have a look into package body "RunChoices.adb".
Procedure "StartTheProcess" for the start with pipes and function
"ReadFromPipe" for how to get the result.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-04-19  7:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-17 23:09 Getting Information already displayed on terminal window Fraz
2002-04-18  8:51 ` Peter Hermann
2002-04-18 11:32   ` Fraz
2002-04-18 13:58     ` Mark Johnson
2002-04-18 19:07   ` Stephen Leake
2002-04-19  7:06 ` Alfred Hilscher
  -- strict thread matches above, loose matches on Subject: below --
2002-04-18 22:04 Gautier Write-only-address

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox