[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help-flex digest, Vol 1 #50 - 2 msgs
From: |
Nicola ONOSE |
Subject: |
Re: Help-flex digest, Vol 1 #50 - 2 msgs |
Date: |
Thu, 28 Jun 2001 19:11:35 +0200 |
> Example of my code is:
> extern Boolean eof1;
> extern Boolean eof2;
> FILE * fileptr1 = fopen("File1", "r");
> FILE * fileptr2 = fopen("File2", "r");
> while(!(eof1 || eof2)){
> yyin=fileptr1;
> yyparse();
> fileptr1=yyin; //to store back the last left off point
> yyin=fileptr2; //no effect??
> yyparse();
> fileptr2=yyin;
> }
> fclose(fileptr1);
> fclose(fileptr2);
Try yywrap().
A few weeks ago, I wrote a program that contained smth.
like this (and I had no problem):
/* yywrap () is called whenever an end of file is being reached */
int yywrap () {
FILE *f = NULL;
fclose (yyin);
printf ("\nInput file :\"%s\"\n", FileList [uFileIndex++]);
if ((char*)0 != FileList [uFileIndex]) {
if ( NULL == (f = fopen (FileList [uFileIndex], "rt")) ) {
printf ("Cannot open file %s ", FileList [uFileIndex]);
perror ("");
exit (1);
}
yyin = f;
}
return ((f)? 0: 1);
}
Nicola
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Help-flex digest, Vol 1 #50 - 2 msgs,
Nicola ONOSE <=