comp.lang.ada
 help / color / mirror / Atom feed
From: ogicse!milton!mfeldman@uunet.uu.net  (Michael Feldman)
Subject: Re: How to put an integer into a char?
Date: 16 Sep 91 04:37:56 GMT	[thread overview]
Message-ID: <1991Sep16.043756.706@milton.u.washington.edu> (raw)

In article <49974@seismo.CSS.GOV> black@beno.CSS.GOV (Mike Black) writes:
>I recently took an Ada class and was trying to use a DOS call to
>make the terminal beep on an input error.  However, I couldn't
>find a (easy) way to put a CTRL-G (ASCII 7) into a CHARACTER object.

ASCII is a sub-package within PACKAGE Standard. I cannot imagine Alsys not
implementing it, as it is required. Try this code:

WITH Text_IO;
PROCEDURE Beep IS
  C: Character;
BEGIN
  C := ASCII.Bel;
  Text_IO.Put(C);
END Beep;

If you insist on working with the numerical values, try
  C := Character'Val(7);
instead of the other assignment. The values in Character are in ASCII collating
sequence, so the above will store in C the Character (ASCII) value in position 
7 of the type, i.e. the Bel character "ASCII 7".

Mike Feldman

-------------------------------------------------------------------------------
Michael B. Feldman
Visiting Professor 1991-92               Professor
Dept. of Comp. Sci. and Engrg.           Dept. of Elect. Engrg. and Comp. Sci.
University of Washington FR-35           The George Washington University
Seattle, WA 98105                        Washington, DC 20052
(206) 685-1376 (voice)                   (202) 994-5253 (voice)
(206) 543-2969 (fax)                     (202) 994-5296 (fax)
-------------------------------------------------------------------------------

             reply	other threads:[~1991-09-16  4:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1991-09-16  4:37 Michael Feldman [this message]
  -- strict thread matches above, loose matches on Subject: below --
1991-09-20 14:03 How to put an integer into a char? Bud Bach
1991-09-15 16:05 Mike Black
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox