comp.lang.ada
 help / color / mirror / Atom feed
* Creating an empty file with Ada.Text_IO
@ 2015-08-24 14:16 Maciej Sobczak
  2015-08-24 16:15 ` Dmitry A. Kazakov
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Maciej Sobczak @ 2015-08-24 14:16 UTC (permalink / raw)


Consider:

with Ada.Text_IO;
use Ada.Text_IO;

procedure Test is
   F : File_Type;
begin
   Create (F, Out_File, "file.txt");
   Close (F);
end Test;

The program creates a file, but before the file is closed, a newline character(s) is written to it. It is, physically, not empty.
Similarly, if a non-terminated line is written (by means of Ada.Text_IO.Put), it is automatically terminated by a newline.

I understand that the intent of the Ada.Text_IO package was to provide a line-oriented file I/O, but it is sometimes getting in the way.
What are the recommended ways of:
a) creating empty files
b) writing a non-terminated line to (or generally at the end of) the file

?

-- 
Maciej Sobczak * http://www.inspirel.com

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

end of thread, other threads:[~2015-08-25 16:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-24 14:16 Creating an empty file with Ada.Text_IO Maciej Sobczak
2015-08-24 16:15 ` Dmitry A. Kazakov
2015-08-25  8:20   ` Maciej Sobczak
2015-08-25 15:26     ` Maciej Sobczak
2015-08-25 16:18       ` J-P. Rosen
2015-08-25 16:45       ` G.B.
2015-08-24 18:51 ` AdaMagica
2015-08-24 22:22   ` Randy Brukardt
2015-08-25  0:06 ` Dennis Lee Bieber

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