comp.lang.ada
 help / color / mirror / Atom feed
* GNAT's Text_IO & empty files
@ 1998-07-06  0:00 Gautier de Montmollin
  1998-07-06  0:00 ` Pascal MALAISE
  1998-07-06  0:00 ` Robert Dewar
  0 siblings, 2 replies; 18+ messages in thread
From: Gautier de Montmollin @ 1998-07-06  0:00 UTC (permalink / raw)
  To: jvandyk@ibm.net


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




^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~1998-07-09  0:00 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-07-06  0:00 GNAT's Text_IO & empty files Gautier de Montmollin
1998-07-06  0:00 ` Pascal MALAISE
1998-07-07  0:00   ` Gautier
1998-07-07  0:00   ` Kevin Radke
1998-07-06  0:00 ` Robert Dewar
1998-07-07  0:00   ` Markus Kuhn
1998-07-07  0:00     ` Gautier
1998-07-07  0:00     ` Samuel Tardieu
1998-07-08  0:00       ` Aaro Koskinen
1998-07-09  0:00         ` Gautier.DeMontmollin
1998-07-09  0:00         ` Samuel Tardieu
1998-07-08  0:00     ` dennison
1998-07-07  0:00   ` Markus Kuhn
1998-07-07  0:00     ` Robert Dewar
1998-07-07  0:00     ` Michael F Brenner
1998-07-07  0:00   ` Gautier
1998-07-07  0:00     ` Robert Dewar
1998-07-07  0:00     ` Robert I. Eachus

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