Subject: RE: putc bug ?
From: [email-masked] (Leo Mauro)

22 Jun 1998 18:35:07 -0700
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
To: <[email-masked]>

On Sunday, June 21, 1998 08:23 PM, John Gumb wrote:

> For amusement, I've been trying to port Intel's I960 tools (CTOOLS)
> to run under Cygnus on 95/NT. I'm almost there...but an oddity in
> putc seems to be causing problems.
[SNIP]
> It looks to me like putc in it's wisdom thinks a <CR> should be
> inserted before what putc interprets as <LF>.
[SNIP]

This is a well known DOS/Win/NT issue.  Please read

http://www.cygnus.com/ml/gnu-win32/1998-Jun/0308.html

in the searchable mailing-list archive for an explanation and
a few solutions.

> Surely it can't be within the ANSI/POSIX rules for putc to be
> doing this ?

It is not putc per se that's doing this.  Even write would do it.
Unless you specify binary mode instead of text mode, as
explained above.

> Interestingly, the above 'problem' happens using Microsoft VC++5.
> Wonder if there's a connection....?

Yes...  They all run under DOS/Win/NT...  By the way, you can
specify binary mode opens under VC++ 5 in the same way as in
CygWin32 (there are no mount points, though).

The ability to specify binary vs. text mode opens has been in
place for some 15 years in all C environments running under
DOS/Win/NT, since the very first ones.

Of course, all this makes no sense under UNIX, where a file
is a file is a file and contains exactly what you put in it.  But
hey!  You're running Windows, where magic and wizards rule
and nothing is what it seems... :-)

Leo

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".