home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / atari / st / tech / 6536 < prev    next >
Encoding:
Text File  |  1993-01-07  |  1.7 KB  |  40 lines

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