* Re: INFO-ADA Digest V93 #56
@ 1993-02-08 18:20 John McCormick
0 siblings, 0 replies; only message in thread
From: John McCormick @ 1993-02-08 18:20 UTC (permalink / raw)
In comp.lang.ada you write:
>Could somebody tell me (email please) why this programme,
>which compiles properly, seemingly stalls at the
>line indicated? i.e. I type in a line followed by <cr>,
>but nothing happens. What should happen is that this:
>*:: <the line that was typed>
>should be printed to the console, but isn't. And nothing
>happens. The input prompt:
>*>>
>is printed, then I can type something, but after <cr>
>nothing happens. :(
>With Text_IO; Use Text_IO;
>Procedure main is
>instr, tokstr : String(1..255);
String may not be the best data structure for your purpose. If the domain
of instr and tokstr are small, an enumeration type is a better choice. You
can instantiate an I/O package for your enumeration type. Its Get
procedure acts more like the ones for numbers. No problems with mixing Gets
and Get_Lines. No problems with line terminators. No problems with upper-
or lowercase. You can even use the DATA_ERROR exception to validate your
input. If you need a string later, there is always 'Image to convert
enumeration values to string values.
I always tell my students to try to use enumeration types rather than
strings.
John
Note: 17 line signature follows
\f
===========================================================================
= John W. McCormick Phone (518) 564-2785 =
= Computer Science Department FAX (518) 564-7827 =
= State University of New York mccormjw@snyplava.bitnet =
= Plattsburgh, NY 12901 mccormjw@splava.cc.plattsburgh.edu =
= USA =
= SUNY Plattsburgh =
= where =
= Computers + Model Railroading = Digitally Controlled Trains =
= =
= * * * =
= * =
= * =
= ## ## T =
= ######_########_########_#####_#########- =
= o o o o o o o o oo OOOO oo\ =
===========================================================================
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1993-02-08 18:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-02-08 18:20 INFO-ADA Digest V93 #56 John McCormick
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox