*BSD News Article 65095


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.mira.net.au!news.vbc.net!samba.rahul.net!rahul.net!a2i!ultra.sonic.net!miwok!bdt.com!news.ossi.com!agate!howland.reston.ans.net!cs.utexas.edu!usc!newshub.csu.net!xsvarshney
From: xsvarshney@ccvax.fullerton.edu (S. Varshney)
Newsgroups: comp.unix.bsd.misc,alt.unix.wizards,comp.unix.misc
Subject: How to write end of file character into file??!
Date: Sat, 06 Apr 1996 20:38:29 -0800
Organization: CSUF
Lines: 21
Message-ID: <xsvarshney-0604962038290001@newshub.csu.net>
NNTP-Posting-Host: d-annex9.fullerton.edu
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.misc:613 alt.unix.wizards:3566 comp.unix.misc:21773



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?

The machine is Unix 5.5 Thanks!


-Suvrit
xsvarshney@ccvax.fullerton.edu