*BSD News Article 65298


Return to BSD News archive

Newsgroups: comp.unix.bsd.misc,alt.unix.wizards,comp.unix.misc
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.mira.net.au!yarrina.connect.com.au!news.mel.connect.com.au!munnari.OZ.AU!news.ecn.uoknor.edu!news.cis.okstate.edu!newsfeed.ksu.ksu.edu!news.mid.net!news.sdsmt.edu!news.wildstar.net!serv.hinet.net!news.cc.nctu.edu.tw!nctuccca.edu.tw!howland.reston.ans.net!newsfeed.internetmci.com!in1.uu.net!iglou!bmarcum
From: bmarcum@iglou.iglou.com (Bill Marcum)
Subject: Re: How to write end of file character into file??!
X-Nntp-Posting-Host: iglou
Message-ID: <DpI5BK.5AE@iglou.com>
Sender: news@iglou.com (News Administrator)
Organization: IgLou Internet Services (1-800-436-4456)
References: <xsvarshney-0604962038290001@newshub.csu.net>
Date: Sun, 7 Apr 1996 17:16:31 GMT
Lines: 24
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.misc:642 alt.unix.wizards:3584 comp.unix.misc:21836

In article <xsvarshney-0604962038290001@newshub.csu.net>,
S. Varshney <xsvarshney@ccvax.fullerton.edu> wrote:
>
>
>I have the following code to write to a file...
>
>Input of variable is done by:
>
>data_f=fopen("input", "a");
> fprintf(data_f, "%s\n", var1);
>
>Now I'm trying to read this file, using fopen("input","r");
>
>The problem is, I can't seem to get a handle on detecting the eof char...
>so as to be able to printf correctly. Any suggestions on how to write the
>file so that an EOF char is written on the file, so that I can read the
>EOF correctly?
>
Unix doesn't use an EOF character, unless you write something at the end 
of the file and look for it when you read the file.

-- 
Bill Marcum              bmarcum@iglou.com
From the future home of the 270 Foot Jesus