home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / c / 19241 < prev    next >
Encoding:
Text File  |  1993-01-05  |  1.3 KB  |  33 lines

  1. Newsgroups: comp.lang.c
  2. From: fred@genesis.demon.co.uk (Lawrence Kirby)
  3. Path: sparky!uunet!pipex!demon!genesis.demon.co.uk!fred
  4. Subject: Re: Fopening a text file 
  5. Distribution: world
  6. References: <1993Jan5.015937.19270@vpnet.chi.il.us>
  7. Organization: BT
  8. X-Mailer: Simple NEWS 1.90 (ka9q DIS 1.19)
  9. Lines: 19
  10. Date: Tue, 5 Jan 1993 12:34:12 +0000
  11. Message-ID: <726237252snz@genesis.demon.co.uk>
  12. Sender: usenet@demon.co.uk
  13.  
  14. In article <1993Jan5.015937.19270@vpnet.chi.il.us> mox@vpnet.chi.il.us writes:
  15.  
  16. >I'm having some problems with a program that I wrote for this computer
  17. >which is running a sys V unix operating system.  My problem is with
  18. >fopen.  When I try do a fopen("filename", "rt"); it opens the file as a
  19. >binary.  If I drop the t, is still creates a binary file.  So how do I
  20. >make fopen create a straight text file?
  21. >
  22.  
  23. In Unix there is no distinction between a binary and a text file. The problem
  24. in DOS is that the line terminator is CR-LF whereas in C it is just LF. So C's
  25. file I/O system has to perform translation for text files. Unix, like C, uses
  26. just LF as a line terminator so no translation is required. Remember C was
  27. created to write Unix.
  28.  
  29. -----------------------------------------
  30. Lawrence Kirby | fred@genesis.demon.co.uk
  31. Wilts, England | 70734.126@compuserve.com
  32. -----------------------------------------
  33.