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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no 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!postnews.google.com!f14g2000cwb.googlegroups.com!not-for-mail From: pamela.lum@gmail.com Newsgroups: comp.lang.ada Subject: Re: Newbie Question: using Text_IO.Open() to read from standard input Date: 12 Oct 2005 18:48:40 -0700 Organization: http://groups.google.com Message-ID: <1129168120.924614.26250@f14g2000cwb.googlegroups.com> References: <1129164557.586640.154480@g14g2000cwa.googlegroups.com> <1129167000.412296.80530@g43g2000cwa.googlegroups.com> NNTP-Posting-Host: 24.108.52.26 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1129168129 24653 127.0.0.1 (13 Oct 2005 01:48:49 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 13 Oct 2005 01:48:49 +0000 (UTC) In-Reply-To: <1129167000.412296.80530@g43g2000cwa.googlegroups.com> User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: f14g2000cwb.googlegroups.com; posting-host=24.108.52.26; posting-account=Wyy6RQ0AAABE7ZEfOphhDPPcqZqmHzC5 Xref: g2news1.google.com comp.lang.ada:5573 Date: 2005-10-12T18:48:40-07:00 List-Id: Tried that (see the code below named test_cl.ada). It fails to detect arguments after the redirect ("<" ) character in the command : ./myprogram < inputfile.txt For example, the output of the code below (test_cl.ada) is as follows: Input: ./test_cl < inputfile.txt The command name : ./test_cl The number of arguments: 0 <-- does not recognize anything after "<" as an argument So why don't i drop the redirect character? Because this is an assignment and our code will be tested using the redirect. Suggestions? CODE FOR DISPLAYING COMMAND LINE ARGUMENTS: Filename: test_cl.ada with Ada.Command_Line; with Gnat.Io; use Gnat.Io; procedure Test_CL is begin -- Writes out the command name (argv[0]) Put (" The command name : "); Put (Ada.Command_Line.Command_Name); New_Line; -- Writes out the number of arguments passed to the program (argc) Put ("The number of arguments: "); Put (Ada.Command_Line.Argument_Count); New_Line; -- Writes out all the arguments using the Argument function. -- (BE CAREFUL because if the number you pass to Argument is not -- in the range 1 .. Argument_Count you will get Constraint_Error!) for I in 1 .. Ada.Command_Line.Argument_Count loop Put (" Argument "); Put (I); Put (": "); Put (Ada.Command_Line.Argument (I)); New_Line; end loop; end Test_CL;