Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ucsd!rutgers!att!ihlpb!gregg From: gregg@ihlpb.ATT.COM (Wonderly) Newsgroups: comp.lang.c Subject: Re: File descriptors and streams and copying thereof. Message-ID: <10222@ihlpb.ATT.COM> Date: 15 Apr 89 20:45:35 GMT References: <1672@fig.bbn.com> Organization: AT&T Bell Laboratories - Naperville, Illinois Lines: 17 From article <1672@fig.bbn.com>, by rsalz@bbn.com (Rich Salz): > In article <1743@leah.Albany.Edu> rds95@leah.Albany.Edu (Robert Seals) writes: > >I want to be able to make "stdin" read from someplace besides, well, > >standard input in the middle of my program, and then go back to where > >it was again. > > Robert wants to have yyparse() read from a different file. We did a > go-round on this a couple of months ago. The answer is to provide your > own routine named input(): The external symbol, yyin, is a (FILE *) which lex uses to read from. Yyin is initialized with (stdin), so you can just change it to whatever stream you need, and then change it back. -- Gregg Wonderly DOMAIN: gregg@ihlpb.att.com AT&T Bell Laboratories UUCP: att!ihlpb!gregg