catopen is failing to open same cat file in different servers, with same setup.
When errno is 0 it means no error from my understanding.
Please tell me if anyone has seen like this before.
If any one knows the reason why it is happening it will be very helpful for me
Sample code i wrote
int main()
{
nl_catd cat;
string fileName;
cout<<"Enter the cat file name: ";
cin>>fileName;
cat = catopen(fileName.c_str(), 0);
if (cat == (nl_catd)-1)
{
cerr << "Unable to open catalogue: " << fileName <<" ....and the Error number: "<<errno<<"\n";
exit(1);
}
printf("File opened...\n");
catclose( cat );
exit(0);
}
Output for above code
For successful case:
./a.out Enter the cat file name: LinkMonitor.epod.cat File opened...
For faliure case:
./a.out Enter the cat file name: ehap_ac_in.epod.cat Unable to open catalogue: ehap_ac_in.epod.cat0
Here 0 is the error code.
You cleared
errnowhen you wrote the string"Unable to open catalogue: "tocerr.You have to save the value of
errnostraight away.