From mboxrd@z Thu Jan 1 00:00:00 1970 Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R.Carter" Newsgroups: comp.lang.ada Subject: Re: Accessing The Command Line Date: Thu, 4 Jul 2024 13:27:05 +0200 Organization: A noiseless patient Spider Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 04 Jul 2024 13:27:05 +0200 (CEST) Injection-Info: dont-email.me; posting-host="50b5dbf55cecfbfcc028657816c23a43"; logging-data="2880740"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+mkTCoqQ2/9dsqyjM5x7CCI8UhLb8+bjU=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:n5b/wTs7Zla0B55CNPrFlY+0yPk= In-Reply-To: Content-Language: en-US Xref: news.eternal-september.org comp.lang.ada:66218 List-Id: On 2024-07-04 02:08, Lawrence D'Oliveiro wrote: Remember that you can concatenate strings: > tio.put("my name: "); > tio.put(cli.Command_name); > tio.Put_Line(""); Tio.Put_Line (Item => "my name: " & Cli.Command_Name); Image functions thus allow similar simplifications. 'Image is one such function, if you can accept the initial space for non-negative values: > tio.Put("nr args: "); > int_io.Put(cli.Argument_Count, width => 1); > tio.Put_Line(""); Tio.Put_Line (Item => "nr args:" & Cli.Argument_Count'Image); For simple cases you can roll your own: function Image (Value : in Integer) return String is Raw : constant String := Value'Image; begin -- Image return Raw ( (if Value < 0 then 1 else 2) .. Raw'Last); end Image; > tio.put("["); > int_io.put(i, width => 1); > tio.put("]: "); > tio.put(cli.argument(i)); > tio.put_line(""); Tio.Put_Line (Item => '[' & Image (I) & "]: " & Image (Cli.Argument (I) ) ); For more complex uses, you can use something like PragmARC.Images[.Image] (https://github.com/jrcarter/PragmARC). You probably should review the definition of Ada.Text_IO (http://www.ada-auth.org/standards/aarm12_w_tc1/html/AA-A-10.html), especially for procedure New_Line. -- Jeff Carter "Write clearly--don't sacrifice clarity for 'efficiency.'" Elements of Programming Style 186