File I/O with lex/yacc

Gary L Dare gld at cunixd.cc.columbia.edu
Thu Aug 30 03:28:30 AEST 1990


Is there any way to get around the use of standard input/output in a
lex file???  The C file generated by lex (from the lexical analyzer
spec you feed in) has the following line hard-coded:

	FILE *yyin = {stdin}, *yyout = {stdout};

however, there doesn't seem to be a way to sneak in a redefinition of
yyin or yyout as a pointer to a file (a single, in-line statement)
except by hand, 'cos a switch{} is generated in C from the lexical
analysis rules.

Is there any way to force a single, inline statement into the C
file generated by lex, other than by hand?

gld
--
~~~~~~~~~~~~~~~~~~~~~~~~ Je me souviens ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Gary L. Dare				No golf courses on
> gld at cunixD.cc.columbia.EDU		Mohawk Indian
> gld at cunixc.BITNET			burial grounds! (Oka, Quebec)



More information about the Comp.unix.questions mailing list