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 X-Received: by 10.180.105.40 with SMTP id gj8mr13455513wib.6.1386712180543; Tue, 10 Dec 2013 13:49:40 -0800 (PST) MIME-Version: 1.0 Path: border1.nntp.ams3.giganews.com!border2.nntp.ams3.giganews.com!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!nntp.giganews.com!w6no11862463wiw.0!news-out.google.com!bd4ni5961wib.0!nntp.google.com!proxad.net!feeder1-2.proxad.net!137.226.231.214.MISMATCH!newsfeed.fsmpi.rwth-aachen.de!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 15:49:36 -0600 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <1d445f04-b670-444f-9858-55da271fe17a@googlegroups.com> <2b6dc37f-4aa6-4c18-be59-8c09f6f37f01@googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: loke.gir.dk 1386712180 13190 69.95.181.76 (10 Dec 2013 21:49:40 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 10 Dec 2013 21:49:40 +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: 3395 Xref: number.nntp.dca.giganews.com comp.lang.ada:184168 Date: 2013-12-10T15:49:36-06:00 List-Id: "Austin Obyrne" wrote in message news:2b6dc37f-4aa6-4c18-be59-8c09f6f37f01@googlegroups.com... On Tuesday, December 10, 2013 6:37:28 AM UTC, Randy Brukardt wrote: ... >Please consider this procedure in the program that gave trouble, > >This is the defacto stripped down procedure > >EXIT when EOF; > EXIT when EOL; > > FOR I IN 1 .. 3 LOOP > Ada.Integer_Text_IO.Get(File => InData, Item => W(I)); > --Ada.Integer_Text_IO.Put(Item => W(I), Width => 8); > END LOOP; > >LOOP; >LOOP; I presume that there is a New_Line in there somewhere so that the line endings aren't lost completely. But this isn't going to work, as Get for a character is defined as follows: "After skipping any line terminators and any page terminators, reads the next character from the specified input file and returns the value of this character in the out parameter Item." So if you have any line endings in between the 1st and 2nd characters (or between the 2nd and 3rd characters), you'll end up ignoring them. I doubt that's what you want. (Ada abstracts the line, page, and file terminators so you don't have to worry about how they're represented. The problem being that you *can't* see how they're represented if you are using Text_IO.) Using Text_IO without losing line endings and the like is tricky. I generally don't bother, just reading a line at a time with Get_Line and then process whatever I get. (And I just ignore page terminators, which are rarely used anyway.) But if I was writing this sort of code, I wouldn't worry about line endings at all, and simply encrypt the file as binary data, using Stream_IO to read it in and out. Randy.