Subject: RE: Where does the "\n" to "\r\n" conversion take place?
From: [email-masked] (Bob McGowan)

20 Mar 1998 21:14:06 -0800
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain
To: Earnie Boyd <[email-masked]>, [email-masked]
Cc: [email-masked]

I cannot shed much light on how cygwin32 might do this, but for the
Microsoft compilers, if I remember correctly, this is "built in" to the
open() function.  The basic operation is \r\n to \n on input and \n to
\r\n on output for _TEXT_ files only.  If a file is opened in BINARY
mode (even if it is actually only text contents) no translation occurs
and you will see both \r and \n in the input.  So, if open() is found in
crtdll.dll then mingw32 should also have this feature.

Individual programs could be written to open a file in binary mode to
see if it uses the DOS or the UNIX line end convention and then do
something "appropriate" for what that program does (I have a win32
version of vim that does this).  So in some senses, the answer is "it
depends" and a search through the involved code may be the only way to
resolve this.

----
Bob McGowan
i'm bobmcgow at xstor dot com
Storage Dimensions, Inc.

-----Original Message-----
From: Earnie Boyd [mailto:[email-masked]]
Sent: Monday, March 16, 1998 10:50 AM
To: [email-masked]
Cc: [email-masked]
Subject: Re: Where does the "\n" to "\r\n" conversion take place?

>Date: Sun, 15 Mar 1998 14:36:51 GMT
>From: [email-masked]
>Subject: Where does the "\n" to "\r\n" conversion take place?
>To: [email-masked]
>
>One thing you discover if you use cygwin with mingw32 to make the lynx
>web browser is that fputc('\n', fp) or fprintf(fp, "\n") in cygwin
>behaves like fprintf(fp, "\r\n") in mingw32.  Since cygwin can be 
set=20
>up to generate mingw32 code, this means that, somewhere outside of
>gcc, the conversion from "\n" to "\r\n" is made.  Or, that there is a
>compiler switch that causes one of the gcc overlays to make this
>conversion, and the mingw32 minimalist system doesn't use it.
>
>Anyone have information on this topic?

I don't have any specifics, but I've noticed that the default read mode 
will read \n or \r\n and the default write mode is to output \r\n.  I 
believe that this behavior is built into the crtdll.dll functions.

-        \\||//
---o0O0--Earnie--0O0o----
[email-masked]
------ooo0O--O0ooo-------

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
-
For help on using this list (especially unsubscribing), send a message
to
"[email-masked]" with one line of text: "help".
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".