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-Thread: 103376,a0833bbed8752e1f X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Thu, 28 Oct 2004 17:39:52 -0500 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <1861614.TWv5A9FgVL@linux1.krischik.com> <4178e979_1@baen1673807.greenlnk.net> <1195374.UMjBCk7lO1@linux1.krischik.com> <1154613.ipZcUgduzp@linux1.krischik.com> <1174011.lJ1dcgRM3Q@linux1.krischik.com> <1098814048.280053@master.nyc.kbcfp.com> <10z8k19febkic.16ex86io5uvwi.dlg@40tude.net> <1ok9c1htwcrmd.dta4w50brarb.dlg@40tude.net> Subject: Re: variable length strings Date: Thu, 28 Oct 2004 17:41:23 -0500 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-7USVmhWxMSyYglzZkjmtAKbyPxciH0twgpoK59y3tNvm+FlW9wNKXR1K4B/k0lHkpaH689EyV9pBlvj!wJ8+o7SivBabzd5rN++xjNutZ+CyDx/tQ63QD1nybLFWSX+m57EJ4RVpvY4qPpXi+QtA9mJNfeQ0 X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.20 Xref: g2news1.google.com comp.lang.ada:5809 Date: 2004-10-28T17:41:23-05:00 List-Id: "Jeffrey Carter" wrote in message news:E2egd.10071$KJ6.6647@newsread1.news.pas.earthlink.net... > More FWIW: I implemented a binding to the C function fgets, which > behaves similarly to Ada.Text_IO.Get_Line (stops at end of buffer or end > of line; in latter case, skips line terminator), and implemented a > Get_Line function using it. It exhibits the same behavior as a Get_Line > function using Ada.Text_IO.Get_Line for the case of a last line that is > not properly terminated and is a multiple of the buffer length. > > Win98/GNAT 3.15p. C is broken so Ada should be too? That makes *no* sense. For the record, Janus/Ada inserts a (single) implied line terminator at the end of a file if there is not one explicitly there. So the OP's technique will work without any headstanding. Note that handling End_Error provides no help in this case, because doing so would cause the last line to be discarded (if there was no implicit line terminator). GNAT's implementation may be technically correct, but an implementation that doesn't allow reading the last line of a file without standing on your head is (practically) broken IMHO. How many people know to worry about this? Randy.