Related articles |
---|
Why some PC C compilers are useless sjg@zen.void.oz.au (1992-05-07) |
Re: Why some PC C compilers are useless cliffc@rice.edu (1992-05-08) |
Re: Why some PC C compilers are useless sjg@melb.bull.oz.au (1992-05-11) |
Re: Why some PC C compilers are useless Zoid@mindlink.bc.ca (1992-05-11) |
Re: Why some PC C compilers are useless bobmon@sandshark.cs.indiana.edu (Bob Montante) (1992-05-12) |
Re: Why some PC C compilers are useless sjg@melb.bull.oz.au (1992-05-13) |
Re: Why some PC C compilers are useless sdm7g@aemsun.med.Virginia.EDU (1992-05-14) |
Newsgroups: | comp.compilers |
From: | Zoid@mindlink.bc.ca (Dave Kirsch) |
Keywords: | C, MSDOS |
Organization: | Compilers Central |
Date: | Mon, 11 May 1992 20:48:00 GMT |
>[I run DOS under Unix here and can second the complaints about programs that
>freak out when they encounter newlines without carriage returns. I can have
>some sympathy for dusty old programs, but not much for current supported ones
>when they do this. -John]
One problem of this is the standard i/o routines provided in the C
libraries by most (if not all) DOS compilers don't handle lines without
carriage returns. Sure, you could use read() and write() and write your
own 'read a line from the file' function that understands cr/lf and just
lf, but you shouldn't have to. The stdio functions take care of that for
you.
What needs to be done is convince compiler companies to make their stdio
routines support lines terminated by linefeeds.
I'm another person who transfers files from DOS to Unix and back a lot,
and it's annoying. I wrote little programs to convert the line
terminators, but it's a pain to do it every time. Also, in my programs I
use a function I wrote called fgetn() which I call instead of fgets()
'cause it handles any sort of line terminator (i.e. cr only terminated
lines [Mac], cr/lf terminated lines [DOS], and lf terminated lines
[Unix]). If just calls getc() looking for a cr or lf, and if it sees a
cr, checks to see if an lf is after it, if so, eat it, if not, push that
character back on the stream. Otherwise, it just returns after hitting a
cr or lf.
--
/// Dave 'Zoid' Kirsch | Vancouver, BC |Internet:
MIND LINK! Communications Corp.| CANADA | zoid@mindlink.bc.ca
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.