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