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: border1.nntp.dca3.giganews.com!backlog3.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!goblin2!goblin.stu.neva.ru!reality.xs3.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Will Ada-95 Programs Written in MS Windows Run in MacOS and Linux Without Some Tweaking. Date: Tue, 10 Dec 2013 00:37:28 -0600 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <1d445f04-b670-444f-9858-55da271fe17a@googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: loke.gir.dk 1386657450 14368 69.95.181.76 (10 Dec 2013 06:37:30 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 10 Dec 2013 06:37:30 +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 X-Original-Bytes: 2451 Xref: number.nntp.dca.giganews.com comp.lang.ada:184157 Date: 2013-12-10T00:37:28-06:00 List-Id: "Simon Wright" wrote in message news:lywqjf45za.fsf@pushface.org... ... > and as far as I can tell this was caused by the Windows line > terminator[2] in the data file; that's to say, when I removed the CR > character from the Windows CR/LF the program decoded correctly. > > I'm not sure of the best way to get an Ada program not to care what sort > of input line terminators it's reading. I'm surprised that that would be a problem, at least for Unix and Windows files. It's pretty simple to design Text_IO so that it can read either properly; that's how Text_IO in Janus/Ada works. (The only difference for it between Windows and Unix versions is the characters output by New_Line). Of course, such a Text_IO would make a real hash out of old Mac files. (I usually use an Ada program to convert text files to Windows format; it's just a simple loop of Get_Line/Put_Line pairs.) But if you don't want to change the terminators (or your compiler has an unnecessarily inflexible Text_IO), I'd suggest using Stream_IO. Of course, then you'll have to do your own buffering of input (but that's usually a good idea anyway). Randy.