LEX Question

Farrukh Najmi najmi at hpcuhb.HP.COM
Tue Feb 14 08:55:48 AEST 1989


Its not clear to me what it is you are trying to do.
Lex produces a function in lex.yy.c called yylex().
This function as a default reads from standard input.

However one can make it read from a file (using file pointer)
by declaring the file pointer variable and then assigning
it to yyin. The yyin assignment must be before after the %%
and before any regular definitions.

%{
extern FILE *input_fileptr;
%}
%%
    yyin = input_fileptr;

/* regular definitions go here. */



More information about the Comp.lang.c mailing list