From: Robert Neinast Newsgroups: comp.os.msdos.djgpp Subject: Re: Can't Even Read File Correctly Message-ID: References: <9sei6v$8j9$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> X-Newsreader: MicroPlanet Gravity v2.50 Lines: 25 Date: Thu, 08 Nov 2001 20:19:04 GMT NNTP-Posting-Host: 12.87.146.53 X-Complaints-To: abuse AT worldnet DOT att DOT net X-Trace: bgtnsc06-news.ops.worldnet.att.net 1005250744 12.87.146.53 (Thu, 08 Nov 2001 20:19:04 GMT) NNTP-Posting-Date: Thu, 08 Nov 2001 20:19:04 GMT Organization: AT&T Worldnet To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com In article , neinast AT worldnet DOT att DOT net says... > In article <9sei6v$8j9$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE>, broeker AT physik DOT rwth- > aachen.de says... > > Robert Neinast wrote: > > > > > This is driving me nuts. In C, I'm doing simple getchars from > > > stdin and writing to a file, and it keeps getting truncated. > > > Anybody have any ideas what the heck I'm doing wrong???? > > > > In DOS, text files have a different line end ("\r\n" instead of a > > simple "\n", in C terms), and Ctrl-Z is interpreted as an end-of-file > > marker. Stdin is opened in *text* mode, by default. One more question: Is there any way to start up bash so that the default is "binary", not "text" mode (yes, I tried looking in the documentation). It really annoys me that programs like ls, wc, and od count those \r\n when its only \n that's there (i.e., they give false counts). Bob -- . . . and shun the Frumious Bandersnatch Robert A. Neinast Pickerington, OH