comp.lang.ada
 help / color / mirror / Atom feed
From: Mats Weber <matsw@mail.com>
Subject: Re: End_Of_File does not work as expected...
Date: 2000/11/26
Date: 2000-11-26T00:00:00+00:00	[thread overview]
Message-ID: <3A20EFFD.5EE29272@mail.com> (raw)
In-Reply-To: rcumv8.b93.ln@127.0.0.1

I find Jeff Carter's reply overly pedantic and paternalistic, given the
reasonable question being asked. And students are welcome to this newsgroup.

Now to the point: If you are used to C and UNIX text files, then Text_IO
is definitely something different. On some systems, (e.g. VMS) a line
terminator is not encoded as a character as it is on UNIX, but as the
end of a record. Text_IO was designed to accomodate such systems as well.

If you want to write the equivalent of UNIX's echo using Text_IO, you
must follow the complete file structure including lines and pages:

while not End_Of_File loop
   while not End_Of_Page loop
      while not End_Of_Line loop
         Get(c);
         Put(c);
      end loop;
      Skip_Line;   -- can be omitted.
      New_Line;
   end loop;
   Skip_Page;   -- can be omitted.
   New_Page;
end loop;

You can omit the page stuff if you don't need it, but you will have to
use End_Of_Line and New_Line because otherwise your output file is going
to be a single line.

Note that if you use End_Of_Page/New_Page, then you will have a page
terminator at the end of your output file even though the input file has
none. My advice: ignore pages in Text_IO.




  parent reply	other threads:[~2000-11-26  0:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-24 23:42 End_Of_File does not work as expected Mika Fischer
2000-11-25  5:14 ` Jeff Carter
2000-11-25  0:00   ` Mika Fischer
2000-11-25  0:00     ` Jeff Carter
2000-11-26  0:00 ` Mats Weber [this message]
2000-11-26  0:00   ` Jeff Carter
2000-11-26  0:00     ` Mats Weber
replies disabled

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