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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.236.4.136 with SMTP id 8mr2888444yhj.21.1394051596748; Wed, 05 Mar 2014 12:33:16 -0800 (PST) X-Received: by 10.140.108.6 with SMTP id i6mr177967qgf.0.1394051596728; Wed, 05 Mar 2014 12:33:16 -0800 (PST) Path: border1.nntp.dca3.giganews.com!backlog3.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!hw13no1057588qab.1!news-out.google.com!bw18ni1187qab.1!nntp.google.com!w5no1058253qac.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 5 Mar 2014 12:33:16 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=188.115.2.128; posting-account=sDyr7QoAAAA7hiaifqt-gaKY2K7OZ8RQ NNTP-Posting-Host: 188.115.2.128 References: <9b780534-04fb-43c8-b8de-1610421c471d@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Reading data from file From: Laurent Injection-Date: Wed, 05 Mar 2014 20:33:16 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Original-Bytes: 3560 Xref: number.nntp.dca.giganews.com comp.lang.ada:185133 Date: 2014-03-05T12:33:16-08:00 List-Id: Am Dienstag, 4. M=E4rz 2014 22:42:37 UTC+1 schrieb Niklas Holsti: > Also try to configure your news-reader to break the lines in your=20 > postings to some reasonable length, say 70 characters. Commenting is > difficult if you post messages with very long lines, at least in my > news-reader (Thunderbird). I don't use a news-reader so difficult to configure. I will try to limit my postings to 1/2 the width. >So the problem is that after reading the ID you must=20 >move the read point to the start of the "name" line.=20 >Add a Skip_Line between the Get(ID) and=20 >the Get_Line(Name).=20 The Skip_Line works only if I use it together with: Ada.Text_IO.Get (File =3D> Import_File, Item =3D> Temp_Record.Name); and this only if I put spaces after "test" to a total length of 30 chars. I suppose the spaces are needed because the name is defined as: MaxName : constant Positive :=3D 30; subtype NameType is String (1 .. MaxName); Get_Line w/ or w/o Skip_Line fails with the same error=20 independently of the number of spaces behind the name. Even tried this: declare=20 S : String :=3D Ada.Text_IO.Get_Line(File =3D> Import_File); begin Temp_Record.Name (1 .. S'Length) :=3D S; end; Works w/o the (File =3D> Import_File). Then it waits for keyboard input and everything is fine. If it tries to read from file then not. Until now I like Ada very much but this odd behavior of Ada.Text_IO.Get/Get_Line drives me crazy. The integer/enumeration getters aren't so picky. @ Mike H >If you don't believe me, try putting a non-numeric=20 >character in the "ID" line. Doesn't even need to be non-numeric. ID needs to be in range 1111..9999. The Insert procedure from keyboard is robust and=20 won't continue until every field is entered correctly. Just began the read from file procedure. Would be happy if that worked. Then I will take care of robustness. >Do not take that as a criticism ... I'm an noob so criticism is quite welcome. I don't earn my money as programmer and probably this never happens so there are a lot of things I don't know.=20 It will help me improve my code, style or whatever. Thanks Laurent