comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <see.my.homepage@gmail.com>
Subject: Creating an empty file with Ada.Text_IO
Date: Mon, 24 Aug 2015 07:16:45 -0700 (PDT)
Date: 2015-08-24T07:16:45-07:00	[thread overview]
Message-ID: <b6ab40d4-f3fd-4a16-9ea4-c64397247214@googlegroups.com> (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

             reply	other threads:[~2015-08-24 14:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-24 14:16 Maciej Sobczak [this message]
2015-08-24 16:15 ` Creating an empty file with Ada.Text_IO 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
replies disabled

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