Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!wuarchive!uunet!mcsun!hp4nl!tnofel!felfs!gtir5 From: gtir5@fel.tno.nl (Ger Timmens) Newsgroups: comp.lang.c Subject: Question about Lex Message-ID: <1991May29.081912.16808@fel.tno.nl> Date: 29 May 91 08:19:12 GMT Organization: TNO Physics and Electronics Laboratory Lines: 29 This is what I do: 1. lex lexcommands /* ==> lex.yy.c */ 2. cc lex.yy.c /* ==> a.out */ 3. a.out < input > output /* ==> output */ I've got the following problem: When I encounter a string in the file *input* I want to generate an error message reporting the line number and file. However I cannot include the following in my *lexcommands* file: "string" fprintf(stderr,"Found *string* on line %d in %s.\n", __LINE__,__FILE__); since this would report the line number in the file *lex.yy.c* ! Is there a solution to this problem ? I've experimented with #line, but I did not succeed. Thanks in advance, =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= = Ger Timmens, Fysisch Elektronisch Laboratorium TNO = =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= = Tel.: 070-3264221 tst. 308 @-mail: gtir5@fel.tno.nl = =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= = >>> Any You Can Do, I Can Do Better, (No You Can't) ... <<< = =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=