help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Is there any problem if absolute path is given as input while handli


From: Vedpathak, Rameshwari IN BLR SISL
Subject: RE: Is there any problem if absolute path is given as input while handling multiple inout files
Date: Mon, 17 Oct 2005 11:42:03 +0530

Hi all,
 
I have written a parser which gets all the function declarations present
in a C header file.
This parser should handle multiple input header files. i have wrriten a
code for this. it works perfectly if i give the inputs to it as just the
header filenames without the fule path i.e. in following way:
test.exe test1.h test2.h or test.exe test1.h
 
but the moment i give absolute path in below way, 
test.exe d:\tmp\out\test1.h
it does not scan the full file, it does not give error but does not scan
the file in proper way. And i am not able to debug why its is happening
like this.
 
It works if i run in normal way i.e. test.exe < d:\tmp\out\test1.h
below is the code which i have written to handle multiple input files.
 

        main(int argc, char *argv[])
        { 
         FILE  *inputFile;
         char *tmpFile;
         numOfFiles = argc - 1;
         openFile();
         fileList = argv+1;
         currentFile = 0;
          
         if (argc == 2)
         {
          strcpy(tmpFile, argv[1]);
          //inputFile = fopen(argv[1], "r");
          printf("tmpFile: %s", tmpFile);
          inputFile = fopen(tmpFile, "r");
          yyin = inputFile;
          currentFile = 1;
         }
         
         if (argc > 2)
         {
          yywrap();
         }
         yyparse();
         
         closeFile();
        }
         
        int yywrap()
        {
         FILE  *inputFile;
         strcpy(typeNames[0], "");
         while(currentFile < numOfFiles)
         { 
          inputFile = fopen(fileList[currentFile], "r");
          yyin = inputFile;
          break;
         }
         if ((currentFile) == numOfFiles)
          return 1;
         else
         { currentFile++;
          return 0;
         }
        }

 

Can anyone please help. 
If absolute path is given is there any probelm????
 
Regards,
Rameshwari


reply via email to

[Prev in Thread] Current Thread [Next in Thread]