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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ccc963ff28188d78 X-Google-Attributes: gid103376,public From: robert_dewar@my-dejanews.com Subject: Re: Putting a 'Duration' on the screen ? Date: 1999/01/18 Message-ID: <780aj4$eh7$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 434120953 References: <36A37529.69BFB3FF@cs.kuleuven.ac.be> X-Http-Proxy: 1.0 x2.dejanews.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Mon Jan 18 21:54:50 1999 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.04 [en] (OS/2; I) Date: 1999-01-18T00:00:00+00:00 List-Id: In article <36A37529.69BFB3FF@cs.kuleuven.ac.be>, Emmanuel Lambert wrote: > Hi, > > I am freaking out because I would like to output a > variable from type Duration to the screen, but it does > not work with put(...). I have included > Ada.Float_Text_Io, but that does not help. Can someone > give me a hint. I a unable to find good documentation on > this. Emmanuel, so that you may avoid freaking in the future, let's help you to figure out how to find your own answer next time :-) First, look up type Duration in the reference manual, a little searching in the RM (I always use the ASCII version it is easier for me to search) finds: 7 There is a predefined fixed point type named Duration, declared in the visible part of package Standard; Ah ha! A *fixed point* type not a *floating point* type. A little more spelunking around in Text_IO digs up: 68 generic type Num is delta <>; package Fixed_IO is 71 procedure Put(File : in File_Type; Item : in Num; Fore : in Field := Default_Fore; Aft : in Field := Default_Aft; Exp : in Field := Default_Exp); and if you know how to use generics you are pretty much home free now. But actually there is an even easier way, and here again is how you could find this. Look up operations on a fixed point type, and you will find the Image attribute, just what the doctor ordered, now you can do Put_Line (Duration'Image (xxx)); which is probably good enough for what you want, though you don't have control over the format as you do with Text_IO. -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own