wrote:
> On Dec 26, 12:56 am, Joe Wright <joewwri...@comcast.net> wrote:
>> CBFalconer wrote:
>>> jacob navia wrote:
>>>> Flash Gordon wrote:
>>> ... snip ...
>>>>> Since you have opened the file in binary mode and MacOS 9.x and
>>>>> earlier use '\r' as the line terminator you have just converted
>>>>> the file to one long line on some systems.> >
>>>> Yes, will not work in DS9000 and MAC os9.x Easy to change though.
>>>> There is no portable way to know what line separator the system
>>>> uses.
>>> Yes there is. Just open the file in text mode (i.e. without the
>>> "rb") and wait until you detect a '\n' in the stream. That is
>>> exactly where a line separator occured.
>> Not here. Opening a text file with CR line terminations in "r" mode is
>> fine but the CR bytes (0x0d) are never seen. I get one long line.
> He is not talking about CR (which is ascii) or 0x0D which is just a
> value, but '\n'.
Ok vippstar whoever you are. You weren't listening. Among the three
systems, Apple, PC and Unix there are three line endings. Apple used a
single CR, Unix a single LF and the PC two bytes, CRLF.
Jacob said "There is no portable way to know what line separator the
system uses". Chuck said "Just open the file in text mode (i.e. without
the "rb") and wait until you detect a '\n' in the stream".
My response to Chuck was that Hell will freeze over before a single CR
in a text stream will be converted to LF for me to see (on my system here).
Do all of us the favor of assuming we know LF is '\n' and CR is '\r'.
Now that you understand my reply to Chuck, please feel free to comment
on it.
Before you attempt to correct me again, "CR is ascii but 0x0d is just a
value" won't fly. You'll have to do better.
Merry Christmas
--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---