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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Problem with Unbounded Strings Date: Mon, 7 Dec 2015 19:53:09 -0600 Organization: JSA Research & Innovation Message-ID: References: <274dc49b-b7cd-4eef-b333-34bae665c992@googlegroups.com> <1957dd23-1034-43fb-b933-c74a7d694207@googlegroups.com> NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1449539589 28083 24.196.82.226 (8 Dec 2015 01:53:09 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 8 Dec 2015 01:53:09 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:28696 Date: 2015-12-07T19:53:09-06:00 List-Id: "Jeffrey R. Carter" wrote in message news:n3t98j$5pj$1@dont-email.me... > On 12/04/2015 04:35 PM, Laurent wrote: >> >> Is there no function in the text io libraries to check which line endings >> are used? > > Afraid not. If you're processing files from several platforms, you can > check for > and trim off a CR at the end. This will work with files from either > platform. It also depends on your vendor's implementation of Text_IO. For Janus/Ada, we treated LF as the line ending and discard a single CR preceding it (if one exists). That way, we didn't have to have separate versions of Text_IO.Get_Line for the different platforms, and it essentially auto-converts between them. (Of course, Text_IO.Put_Line has to output different line terminators on the different platforms.) IMHO, this the best approach for Text_IO, but it does have one drawback... > However, all bets are off if you might get a file with the old Mac CR line > terminators. I worked on a system that used the Get_Line function and > dealt with > CRs as above since many of the files we processed were produced on Windows > systems. One day we got a 5-MB file saved with CRs for line terminators. > Get_Line attempted to read a 5-MB line. That was not pretty. ..and that's it. Doesn't seem worse than any other possibility, though. Randy.