File descriptors and streams and copying thereof.

Wonderly gregg at ihlpb.ATT.COM
Sun Apr 16 06:45:35 AEST 1989


>From article <1672 at fig.bbn.com>, by rsalz at bbn.com (Rich Salz):
> In article <1743 at leah.Albany.Edu> rds95 at 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 at ihlpb.att.com
AT&T Bell Laboratories                     UUCP:   att!ihlpb!gregg



More information about the Comp.lang.c mailing list