Xref: utzoo comp.unix.questions:25090 comp.misc:9956 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!uwm.edu!psuvax1!rutgers!cunixf.cc.columbia.edu!cunixd.cc.columbia.edu!gld From: gld@cunixd.cc.columbia.edu (Gary L Dare) Newsgroups: comp.unix.questions,comp.misc Subject: File I/O with lex/yacc Summary: getting around stdin/stdout in lex ... but not by hand! Keywords: lex, yacc, file i/o Message-ID: <1990Aug29.172830.14348@cunixf.cc.columbia.edu> Date: 29 Aug 90 17:28:30 GMT References: <2320@cirrusl.UUCP> <1990Aug29.122152.1600@virtech.uucp> Sender: news@cunixf.cc.columbia.edu (The Daily News) Reply-To: gld@cunixd.cc.columbia.edu (Gary L Dare) Organization: The Ghostbusters Institute at Columbia University Lines: 21 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@cunixD.cc.columbia.EDU Mohawk Indian > gld@cunixc.BITNET burial grounds! (Oka, Quebec)