help-flex
[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 whilehandlin


From: Vedpathak, Rameshwari IN BLR SISL
Subject: RE: Is there any problem if absolute path is given as input whilehandling multiple inout files
Date: Tue, 18 Oct 2005 13:03:32 +0530

I have tried with all the possible combinations of backslashes.
The main problem is that it does not give error message but it just does not scan the file properly.
The output i get after running test.exe < test1.h is different from test.exe d:\tmp\test1.h
 
 
Regards,
Rameshwari


From: Thurn, Martin [mailto:address@hidden
Sent: Monday, October 17, 2005 6:30 PM
To: Vedpathak, Rameshwari IN BLR SISL
Subject: RE: Is there any problem if absolute path is given as input whilehandling multiple inout files

  It probably has to do with the backslashes.  For starters, read the man page for fopen, check for failure, check the error code.
 - - Martin


From: address@hidden [mailto:address@hidden On Behalf Of Vedpathak, Rameshwari IN BLR SISL
Sent: Monday, October 17, 2005 07:55
To: address@hidden
Subject: Is there any problem if absolute path is given as input whilehandling multiple inout files

 
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]