Shouldn't that be fopen not fread?
On Feb 27, 2008, at 1:09 PM, asha b b wrote:
>
> Hello All,
> I have a code of lex for parsing a file info.Since the yyin is
> defaulted for stdin I am not
>
> able to give my file as input from the program.Here is what I have
> tried
>
> ...
> ..
> %option nostdinit
>
> ....
>
> %%
> int main(void)
> {
> FILE *fp;
> fp = fread("D:\\Mytext.txt","r");
> yyin = fp;
> yylex();
> }
>
> Here the yyin accepts the file pointer value. but once the yylex()
> starts the yyin is set to NULL
>
> and later initialized to stdin.It excutes certain statements
>
> /* this code is generated by scanner*/
> if(!yyin) ...(1)
> yyin = stdin;...(2)
>
> in the above main it executes yyin = fp but later when yylex() is
> debugged it executes these
>
> statements(1) and (2) and yyin shows NULL and so stdin is still
> getting assigned to it .
>
>
> Please let me know if yyin is to be initialized else where or exact
> procedure for doing so. I am
>
> working on C (Windows).
>
> Thanks in advance
>
> with regards
>
>
>
>
> ----------------------------------------------------------------------
> ---
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Flex-help mailing list
> Flex-help@...
> https://lists.sourceforge.net/lists/listinfo/flex-help
|