[GAP] LF to CR-LF

Daniel Lewandowski daniellewandowski at tlen.pl
Mon Aug 28 17:45:54 CEST 2006


Dnia 28-08-2006, pon o godzinie 10:05 -0400, Robert Dewar napisał(a):
> John McCormick wrote:
> > Daniel,
> > 
> > Would using a sequential file of characters work for your 
> > problem?  Sequential_IO does not interpret like Text_IO.
> 
> stream_io would be a much better choice, the format of
> sequential_io files is implementation dependent.

I can now agree. The solution is below. Looks and works nice. It writes
exactly what it has to and doesn't add any unexcpected character.

Thanks for help.

Regards,
Daniel Lewandowski

-----------------------------------------------------------------------

with Ada.Characters.Latin_1; use Ada.Characters;
with Ada.Streams.Stream_IO;  use Ada.Streams.Stream_IO;

procedure S is
   File : File_Type;
   Line : constant String :=
      "ala " & Latin_1.CR & Latin_1.LF &
      "ma " & Latin_1.LF & 
      "kota " & Latin_1.CR & Latin_1.LF &
      "a ola " & Latin_1.CR &
      "psa" & Latin_1.FF;

   File_Stream : Stream_Access;

begin
   Create (File => File, Name => "out.txt", Mode => Out_File);
   File_Stream := Stream (File => File);

   String'Write (File_Stream, Line);

   Close (File => File);
end S;




More information about the GAP mailing list