From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,479138db2311e415 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 12 Oct 2005 22:13:51 -0500 From: "Steve" Newsgroups: comp.lang.ada References: <1129164557.586640.154480@g14g2000cwa.googlegroups.com> Subject: Re: Newbie Question: using Text_IO.Open() to read from standard input Date: Wed, 12 Oct 2005 20:15:10 -0700 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original Message-ID: NNTP-Posting-Host: 24.22.63.157 X-Trace: sv3-ToJU/Hp6IIeVSmVR+KFvEODOk1cycGWEZAklJFcUGiiKDJukxc006fv9szd2E8VdMdEa9bV3EGfX7nN!EWXCnp3icnsYDXiR2T/OxF0uEBr7JOjMsq3wxAEklHueqycXQEcum+Qik2NCZpk2kmdFNkqaj4A= X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news1.google.com comp.lang.ada:5580 Date: 2005-10-12T20:15:10-07:00 List-Id: wrote in message news:1129164557.586640.154480@g14g2000cwa.googlegroups.com... > Hi, > > I need to open a file that is passed to my ada executable as standard > input, in the following fashion: > > ./myprogram < inputfile.txt > > My question is: How can i get the Open() function to open a file from > standard input so that I can bypass using a static file name? For > example: > > Integer_File : FILE_TYPE; > Open(Integer_File, In_File, "inputfile.txt"); <-- don't open > inputfile.txt, open file from standard input instead > > I know that this can be done easily with Ada.Text_IO.Text_Streams, > however I am stubborn and curious to see if there is a simple and easy > way to do it with the Open() function. > > THanks > The following simple example works on red hat linux 8.0 with Ada.Text_IO; procedure TestPassThru is package Text_IO renames Ada.Text_IO; begin while not Text_IO.End_Of_File loop declare text : String( 1 .. 255 ); last : Natural; begin Text_IO.Get_Line( text, last ); Text_IO.Put_Line( text( 1 .. last ) ); end; end loop; end TestPassThru; (Sorry for any typo's I had to copy the code from one screen to another). Steve (The Duck)