Mail Archives: djgpp/1997/08/26/03:20:16
On 25 Aug 1997, firewind wrote:
> Cesar Scarpini Rabak <csrabak AT dce03 DOT ipt DOT br> wrote:
>
> > Text format is not _that_ highly portable! When one switches from
> > environment the way the end of line is marked varies, and filters or
> > converting programms may be needed...
>
> Unlike some fortunate people, I don't have a copy of the ANSI standard handy,
> but in K&R2, chapter 7, section 1, is is said:
>
> "A text stream consists of a sequence of lines; each line ends with a newline
> character. If the system doesn't operate that way, the library does whatever
> is necessary to make it appear as if it does. For instance, the library might
> convert carriage return and linefeed to newline on input and back again on
> output."
Correct, but not quite to the point.
The problem here is that if you create a text file on DOS then move it to
Unix, the programs there will have difficulties handling it. Since Unix
*does* ``operate that way'' (i.e., its native text files *do* end with
the newline alone), libc on Unix doesn't do any conversions, and the CRs
stay.
ANSI only makes the behavior consistent as long as you stay on the same
platform, but it doesn't tell anything about moving files between
different platforms.
- Raw text -