*BSD News Article 65344


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!news.ecn.uoknor.edu!news.cis.okstate.edu!newsfeed.ksu.ksu.edu!news.physics.uiowa.edu!math.ohio-state.edu!howland.reston.ans.net!news.starnet.net!waikato!chch.planet.co.nz!fred.mcbbs.gen.nz!fred.mcbbs.gen.nz!not-for-mail
From: daniel@mcbbs.gen.nz (Daniel Ayers)
Newsgroups: comp.unix.bsd.misc,alt.unix.wizards,comp.unix.misc
Subject: Re: How to write end of file character into file??!
Followup-To: comp.unix.bsd.misc,alt.unix.wizards,comp.unix.misc
Date: 8 Apr 1996 21:42:14 +1200
Organization: Mirth Control (Private) BBS, Christchurch, NZ
Lines: 21
Message-ID: <4kan1m$suq@fred.mcbbs.gen.nz>
References: <xsvarshney-0604962038290001@newshub.csu.net>
NNTP-Posting-Host: fred.mcbbs.gen.nz
X-Newsreader: TIN [version 1.2 PL2]
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.misc:653 alt.unix.wizards:3590 comp.unix.misc:21859

: The problem is, I can't seem to get a handle on detecting the eof char...

UNIX does not put an "EOF char" in files.  EOF is a *condition* that occurs
when all the data in a file has been read.

If you want to get far in UNIX, you'll have to learn to read man pages.  Look
at the man pages for the functions you are using, and they will tell you
what happens when you read past the end of the file.

gets/fgets is a good way to read from files on a line-by-line basis.  Read
the man pages for them.

Daniel.

 ------------------------------------------------------------------------------
 Daniel Ayers, B.Sc (Hons), M.Sc     Mobile: +64-25-387-334 FAX: +64-3-351-5090
 Software Engineer, Securicor 3net, New Zealand          daniel@securicor.co.nz
 Internet/UNIX/WAN/Computing Consultant                     daniel@mcbbs.gen.nz