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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8d3f28f2a74233d2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2000-12-31 07:50:16 PST Path: supernews.google.com!sn-xit-02!supernews.com!newsfeed.mesh.ad.jp!sjc-peer.news.verio.net!news.verio.net!iad-read.news.verio.net.POSTED!kilgallen From: Kilgallen@eisner.decus.org.nospam (Larry Kilgallen) Newsgroups: comp.lang.ada Subject: Re: Newbie Questions about Get, Get_Line Message-ID: References: <92l4s4$hjb$1@nnrp1.deja.com> <98pt4t477fqavihkgfbjioo7peo9vb7f20@4ax.com> Organization: LJK Software Date: 31 Dec 2000 10:50:04 -0500 NNTP-Posting-Host: 216.44.122.34 X-Complaints-To: abuse@verio.net X-Trace: iad-read.news.verio.net 978277807 216.44.122.34 (Sun, 31 Dec 2000 15:50:07 GMT) NNTP-Posting-Date: Sun, 31 Dec 2000 15:50:07 GMT Xref: supernews.google.com comp.lang.ada:3489 Date: 2000-12-31T10:50:04-05:00 List-Id: In article <98pt4t477fqavihkgfbjioo7peo9vb7f20@4ax.com>, gressett@iglobal.net writes: > Ted Dennison wrote: > >>In article , >> gressett@iglobal.net wrote: >> >>> What I would really find useful is a routine that could take a string >>> variable and fill it with terminal input with the following >>> properties: >>> >>> If the user input is shorter that the string variable, it will be >>> padded with blanks. >> >>Ewww. Why would you want that? Its soooo sloppy (not to mention >>wasteful). Plus it would significantly complicate dealing with the >>string later. > > It's a fixed-length String variable; I have to pad it with something, > and in this case, the fixed-length string is a good match to the > requirements of the problem being solved. > > The real problem here is that the designers of the Ada.Text_IO package > quit too soon. There should have been an Ada.Interactive_IO which > would deal with more of the problems of screen and Keyboard IO in a > standard way. While you may view padding with blanks as a "standard way" some of us look at it (within a program) only as a method to emulate other programming languages. When one writes to a fixed record file it may be of use, at which time I would write: record_buffer.street_address := fixed_blank_street_address; record_buffer.street_address ( 1 .. street'length ) := street; of course with some earlier checks to ensure street'length is no greater than record_buffer.street_address'length. Ada will catch such an error on the second line above, but checking earlier in the program can make it easier to create a clean error message. ============================================================================== Great Inventors of our time: Al Gore -> Internet; Sun Microsystems -> Clusters ==============================================================================