[GAP] LF to CR-LF
John McCormick
mccormick at cs.uni.edu
Mon Aug 28 15:39:20 CEST 2006
Daniel,
Would using a sequential file of characters work for your
problem? Sequential_IO does not interpret like Text_IO.
John
At 03:32 PM 8/28/2006 +0200, you wrote:
>Dnia 28-08-2006, pon o godzinie 08:54 -0400, Robert Dewar napisaÅ(a):
> > Because by default Text_IO files are opened in the mode where the
> > OS changes any occurrence of LF to CR/LF, which seems to be the best
> > default choice. If you look at your program:
> >
> > procedure S is
> > File : File_Type;
> > Line : constant String := "ala ma" & Latin_1.Lf & " kota";
> > begin
> > Create (File => File, Name => "out.txt", Mode => Out_File);
> > Put_Line (File => File, Item => Line);
> > Close (File => File);
> > end S;
> >
> > On a Unix system this would create a standard format text file with
> > two lines. With the default interpretation we have chosen, this
> > program will have the same effect in a DOS type environment.
> >
> > If we chose to output the LF on its own, the resulting file would not be
> > a standard format text file.
>
>I understand this. But the real problem is in case the string contains
>CR & LF. Text_IO sees LF and inserts CR before it. As a result I have CR
>& CR & LF in a "standard" text file. Some applications really don't like
>this line terminator.
>
> > If you want the effect of LF's without CR's, you could get this by
> > manually opening the C stream with appropriate options, but then the
> > marker at the end of all lines would be simply LF.
>Not so elegant but I will try this. I can manually add CR at the end of
>a string.
>
>Regards,
>Daniel Lewandowski
John W. McCormick mccormick at cs.uni.edu
Computer Science Department
University of Northern Iowa voice (319) 273-6056
Cedar Falls, IA 50614-0507 fax (319) 273-7123
http://www.cs.uni.edu/~mccormic/
More information about the GAP
mailing list