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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fb00b4031f5d9d4a X-Google-Attributes: gid103376,public From: eachus@spectre.mitre.org (Robert I. Eachus) Subject: Re: GNAT's Text_IO & empty files Date: 1998/07/07 Message-ID: #1/1 X-Deja-AN: 369341596 References: <35A0B7C5.1011D794@Maths.UniNe.CH> <35A200D9.E5AAC021@maths.unine.ch> Organization: The Mitre Corp., Bedford, MA. Newsgroups: comp.lang.ada Date: 1998-07-07T00:00:00+00:00 List-Id: In article <35A200D9.E5AAC021@maths.unine.ch> Gautier writes: > Maybe you mean that the line feed is a line and file terminator . It's true > on Unix, it false on DOS or Windows, where it is a line separator. > It's like the ';' which follows intructions in Ada but separate them > in Pascal. > << These lines were not put in for amusement! >> > Oh, you surprise me! Are you serious? It is possible to have a mapping in Text_IO such that an empty file contains no bytes. However, to do that correctly requires relying on state in the (Ada) file descriptor, since the Ada notion of a text file ends with an line terminator, followed by a page terminator, followed by the end of file. Try it. Open an empty file for reading, and call Page. It will return 1. Now call End_of_File. It will return true. Now call Skip_Line (or Skip_Page). Page is now 2, but End_of_File is still true. Call Skip_Line again and get End_Error. -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...