Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!ukc!cam-cl!news From: cet1@cl.cam.ac.uk (C.E. Thompson) Newsgroups: comp.text.tex Subject: Re: TeX guru help needed Keywords: \loop \par Message-ID: <1991Jun26.115538.1710@cl.cam.ac.uk> Date: 26 Jun 91 11:55:38 GMT References: Reply-To: cet1@cl.cam.ac.uk (C.E. Thompson) Distribution: comp Organization: U of Cambridge Comp Lab, UK Lines: 34 In article pfeiffer@cix.cict.fr (Daniel Pfeiffer) writes: >I want to read and parse every line in a file that contains no >empty lines: > > \openin\@std \bookname.sind > \loop > \read\@std to\@theline > \ifx\@theline\par\encorefalse\fi > \ifencore {rest of code omitted} > \repeat > >I read from a file whose lines are all uniform, and recognized by \@parse. >When I get to the end of the file the value of \@theline is \par. So I >figured I'd test for the end with \ifx\@theline\par. Problem is that >\loop tries to read everything upto \repeat but falls flat on it's face >when it sees the \par. ... As Rainer Sch"opf has pointed out, using \ifeof\@std is much the easiest and clearest way to make the test. However, it may be worth pointing out that the \ifx test wouldn't work even if you had managed to get the \par into the \loop. \@theline is a macro containing only \par at this time, not \par itself. You could write \def\@lastline{\par} \loop ... \ifx\@theline\@lastline ... and that solves both problems. Chris Thompson JANET: cet1@uk.ac.cam.phx Internet: cet1%phx.cam.ac.uk@nsfnet-relay.ac.uk