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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,d54559bde05f5bb8 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.germany.com!news-2.dfn.de!news.uni-weimar.de!not-for-mail From: stefan-lucks@see-the.signature Newsgroups: comp.lang.ada Subject: Re: Weird string I/O problem Date: Wed, 3 Dec 2008 12:35:34 +0100 Organization: Bauhaus-Universitaet Weimar Message-ID: References: <184a2bfd-4d95-434b-91e0-64c8f869e8b7@r15g2000prh.googlegroups.com> <_7sZk.171628$Mh5.91283@bgtnsc04-news.ops.worldnet.att.net> Reply-To: stefan-lucks@see-the.signature NNTP-Posting-Host: medsec1.medien.uni-weimar.de Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: tigger.scc.uni-weimar.de 1228303465 27091 141.54.178.228 (3 Dec 2008 11:24:25 GMT) X-Complaints-To: news@tigger.scc.uni-weimar.de NNTP-Posting-Date: Wed, 3 Dec 2008 11:24:25 +0000 (UTC) X-X-Sender: lucks@medsec1.medien.uni-weimar.de In-Reply-To: <_7sZk.171628$Mh5.91283@bgtnsc04-news.ops.worldnet.att.net> Xref: g2news1.google.com comp.lang.ada:2857 Date: 2008-12-03T12:35:34+01:00 List-Id: On Wed, 3 Dec 2008, anon wrote: > -- Build your own input routine. Example: [...] if the variable Last is not initialised to 0 *before* you enter the loop ... > begin > Put ( P ) ; > input_string := ( others => nul ) ; > for index in input_string'Range loop -- limits data size > Get ( char ) ; > -- Traps both LF or CR/LF type of EOL > exit when char = CR or char = LF ; ... and if the user immediately presses the return key (i.e., if you read an empty line), ... > input_string ( index ) := char ; > Last := Index ; > end loop ; > if char = CR then -- for CR/LF pairing type of OSs > Get ( char ) ; > end if ; > if char = LF or Last = input_string'Last then -- process EOL on screen > New_Line ; > end if ; > -- valid data is input_string ( 1 .. last ) ; > -- with no term control characters like LF or CR ... then Input_String ( 1.. Last ) depends on the uninitialised variable Last ... > return ( input_string ( 1 .. last ) ) ; ... and the statement above may raise an exception. > end get ; -- ------ Stefan Lucks -- Bauhaus-University Weimar -- Germany ------ Stefan dot Lucks at uni minus weimar dot de ------ I love the taste of Cryptanalysis in the morning! ------