comp.lang.ada
 help / color / mirror / Atom feed
From: Gautier de Montmollin <Gautier.deMontmollin@Maths.UniNe.CH>
To: "jvandyk@ibm.net" <jvandyk@ibm.net>
Subject: GNAT's Text_IO & empty files
Date: 1998/07/06
Date: 1998-07-06T00:00:00+00:00	[thread overview]
Message-ID: <35A0B7C5.1011D794@Maths.UniNe.CH> (raw)


When you create a text file and close it without writing
anything in it, you get an empty line. This is due to an
explicit statement in procedure Terminate_Line from Ada.Text_IO.

This causes an annoying compatibility problem a in DOS or Windows
context, since you get a 1-line, 2-bytes text instead of a 0-line,
0-byte one.

My question is: 
Is it a (a) text file formatting question or (b) a file terminator
question  ? The (b) point of view would be that Text_IO tries
to have a line feed at the end of each text file, although
the only explicit (and facultative) file terminator seems to be the
EOF character. Mine is (a) and I feel it's both harmless and 
profitable to comment out the lines following this remark in procedure
Terminate_Line:

    --  For files other than standard error and standard output, we
    --  make sure that an empty file has a single line feed, so that
    --  it is properly formatted. We avoid this for the standard files
    --  because it is too much of a nuisance to have these odd line
    --  feeds when nothing has been written to the file.

         elsif (File /= Standard_Err and then File /= Standard_Out)
           and then (File.Line = 1 and then File.Page = 1)
         then
            New_Line (File);
         end if;

Comments ?... Reactions ?...

-- 
Gautier




             reply	other threads:[~1998-07-06  0:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-07-06  0:00 Gautier de Montmollin [this message]
1998-07-06  0:00 ` GNAT's Text_IO & empty files Robert Dewar
1998-07-07  0:00   ` Markus Kuhn
1998-07-07  0:00     ` Samuel Tardieu
1998-07-08  0:00       ` Aaro Koskinen
1998-07-09  0:00         ` Samuel Tardieu
1998-07-09  0:00         ` Gautier.DeMontmollin
1998-07-07  0:00     ` Gautier
1998-07-08  0:00     ` dennison
1998-07-07  0:00   ` Markus Kuhn
1998-07-07  0:00     ` Michael F Brenner
1998-07-07  0:00     ` Robert Dewar
1998-07-07  0:00   ` Gautier
1998-07-07  0:00     ` Robert Dewar
1998-07-07  0:00     ` Robert I. Eachus
1998-07-06  0:00 ` Pascal MALAISE
1998-07-07  0:00   ` Kevin Radke
1998-07-07  0:00   ` Gautier
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox