D
Dan Pop
True. That doesn't mean we should never try to do something reasonable
with it, though.
How can you do *anything* reasonable once undefined behaviour has been
invoked (by opening the file in the wrong mode)?
(I'm not saying one should /always/ catch weird
newlines, but for programs that need maximum robustness and
user-friendliness I do think it's one of the first things to do.)
As I already said in the text you've snipped, it is the user's job to
properly import the text file on the system he wants to process it. This
way, there is no undefined behaviour and the program need not try to do a
job it cannot be reliably done.
Last time I checked, file transfer protocols had a text mode that did
the right thing when dealing with text files, including character set
conversions. Furthermore, utilities for converting one text file format
to another are widely available (even a green newbie should be able to
convert between Unix, Windows and MacOS formats). Such a program has
the advantage that it knows what to expect as input format, it doesn't
have to resort to wild guessing.
Dan