From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader02.eternal-september.org!aioe.org!8nKyDL3nVTTIdBB8axZhRA.user.46.165.242.75.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Integer_IO or Modular_IO with different base as default Date: Mon, 15 Nov 2021 21:40:30 +0000 Organization: Aioe.org NNTP Server Message-ID: References: <49db08e4-4380-4877-9e50-a986856c9821n@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: gioia.aioe.org; logging-data="47723"; posting-host="8nKyDL3nVTTIdBB8axZhRA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org"; User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (darwin) X-Notice: Filtered by postfilter v. 0.9.2 Cancel-Lock: sha1:0Hxe3QDFlDTHhxnSj6uCHsCK9vA= Xref: reader02.eternal-september.org comp.lang.ada:63120 List-Id: Ken Roberts writes: > I've been trying to look at how to instantiate Ada.Text_IO.Integer_IO > and Ada.Text_IO.Modular_IO with a different base as default (base 8 > for a project I'm playing with while learning). > > So far, the only thing I can find is instantiate with a different > integer (or mod number), but the base is always defined as 10. > > I'd like to output numbers for the project in base 8 (octal) in > keeping with the documentation on how the digital system works. You can't change Default_Base, but you can specify the base in which to output the number, as in ARM A.10.8(11): procedure Put(File : in File_Type; Item : in Num; Width : in Field := Default_Width; Base : in Number_Base := Default_Base); procedure Put(Item : in Num; Width : in Field := Default_Width; Base : in Number_Base := Default_Base); e.g. Put (10, Base => 8); outputs 8#12#