home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!uknet!fulcrum!its!silver.its.bt.co.uk!jvt
- From: jvt@its.bt.co.uk (John Trickey)
- Newsgroups: comp.sys.atari.st.tech
- Subject: Re: Porting UNIX Code to the ST
- Message-ID: <1993Jan7.124324.27805@its.bt.co.uk>
- Date: 7 Jan 93 12:43:24 GMT
- References: <1993Jan5.214420.8268@sae.com>
- Sender: @its.bt.co.uk
- Organization: BT Group Computing Services, Birmingham, UK
- Lines: 27
-
- In article <1993Jan5.214420.8268@sae.com> malay@sae.com writes:
- >
- >I have some code that generates a binary file - I compiled it with GCC 2.3.1
- >and ran it on the ST - it works fine, it generates a binary file; however, the
- >print statements seem to be outputting a CNTRL-M (^M) - I don't need these
- >extra characters what should I do to get rid of them???
-
-
- 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.
-
- NOTE for developers:
- There is nothing stopping you using these binary formats in Unix. Any decent
- implementation will recognize them. They obviously will have no effect but
- its then easy to port to DOS-type environments.
-
- John
- --
- John Trickey <jvt@its.bt.co.uk>
- Voice: +44 21 524 8200 Fax: +44 21 553 6120
- (Home) <john@its.bt.co.uk> || <john@g4rev.ampr.org> || G4REV @ GB7FLG
- +44 21 308 8892
-