delorie.com/archives/browse.cgi | search |
Xref: | news-dnh.mv.net comp.os.msdos.djgpp:1144 |
Path: | news-dnh.mv.net!mv!news.sprintlink.net!sunic!sunic.sunet.se!news.uni-c.dk!diku.dk!terra |
From: | terra AT diku DOT dk (Morten Welinder) |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: Text/Binary mode of stdin,stdout,stderr |
Date: | 25 Jul 1995 14:06:31 GMT |
Organization: | Department of Computer Science, U of Copenhagen |
Lines: | 34 |
Sender: | terra AT tyr DOT diku DOT dk |
References: | <DC823n DOT 84K AT jade DOT mv DOT net> <3v2jvc$1va AT clus1 DOT ulcc DOT ac DOT uk> |
Nntp-Posting-Host: | odin.diku.dk |
To: | djgpp AT sun DOT soe DOT clarkson DOT edu |
Dj-Gateway: | from newsgroup comp.os.msdos.djgpp |
cziwkga AT pluto DOT ulcc DOT ac DOT uk (Kevin Ashley) writes: >|> From emacs.c: >|> >|> #ifdef MSDOS >|> /* We do all file input/output as binary files. When we need to translate >|> newlines, we do that manually. */ >|> _fmode = O_BINARY; >|> (stdin)->_flag &= ~_IOTEXT; >|> (stdout)->_flag &= ~_IOTEXT; >|> (stderr)->_flag &= ~_IOTEXT; >|> #endif /* MSDOS */ >|> >|> The #define _IOTEXT is not in stdio.h (it was in previous versions). Is it >|> the same as pre v2? Is there a "portable" or "standard" way to do this in >|> ANS C? > > The portable and standard way is with setmode(), as other replies have > indicated. What's being done above is generally bad news ; programs should > treat the FILE * object as an opaque thing and not fiddle with its > insides. The reason the above code looks like it does in Emacs is (ikf I remember things right) that I copied it from Demacs. The reason it looked like that in Demacs probably was that the library wasn't able to do it when Demacs was created. The above should now be considered dirty and setmode() used. Eventually I or someone else will clean up Emacs. Morten
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |