home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.atari.st.tech
- Path: sparky!uunet!spool.mu.edu!enterpoop.mit.edu!mintaka.lcs.mit.edu!kropotkin.gnu.ai.mit.edu!entropy
- From: entropy@gnu.ai.mit.edu (maximum entropy)
- Subject: Re: Porting UNIX Code to the ST
- In-Reply-To: jvt@its.bt.co.uk's message of 7 Jan 93 12:43:24 GMT
- Message-ID: <ENTROPY.93Jan7224017@kropotkin.gnu.ai.mit.edu>
- Sender: news@mintaka.lcs.mit.edu
- Organization: Not Proud Programmers
- References: <1993Jan5.214420.8268@sae.com> <1993Jan7.124324.27805@its.bt.co.uk>
- Date: Fri, 8 Jan 1993 03:40:17 GMT
- Lines: 27
-
- In article <1993Jan7.124324.27805@its.bt.co.uk> jvt@its.bt.co.uk (John Trickey) writes:
-
- >The problem you have encountered is that Unix treats all files alike while
- >DOS, TOS etc do not. In Unix the open is fopen(filename,mode) where mode is
- >a char * of "a","r","w","r+","w+","a+". In TOS these are for text files with
- >CRLF being converted to LF on input and LF being converted to CRLF on output.
- >Note CR is ^M.
- >To switch this off you need to open the file in binary mode. These modes
- >are "ab","rb","wb","rb+","wb+","ab+". The format "r+b" etc is also acceptable.
-
- Alternatively, the call:
-
- _binmode(1);
-
- somewhere at the beginning of a program will cause all fopen()s to
- default to binary mode (you can then force text mode with the "t"
- modifier in the mode specifier.) It's much easier, (and cleaner,
- IMHO) to make this one small hack than to hunt down all the file mode
- arguments all over a large program.
-
- Cheers,
- entropy
- --
- entropy@gnu.ai.mit.edu
- entropy. . .it's not just a good idea, it's the second law.
- Boycott AT&T, Lotus, Apple, and Xerox. Join the League for
- Programming Freedom! Write to lpf@uunet.uu.net for more information.
-