The general structure of the code is like this.
----------------------------------------------------------------------------------
cout << "Before rmdir errno is " << errno << endl;
result = rmdir(string_variable);
k = errno;
cout << "After rmdir errno is " << k << endl;
cout << "result is " << result << endl;
if(result == -1) {
if( (k = this) || (k == that) || (k == somethingelse))
{
do this;
}
else {
switch(k) {
case ENOTDIR: //All listed values for
cout << "ENOTDIR"; // errno in man pages
break; // for rmdir
....................
....................
default:
cout << "None of the above";
}
cout << endl;
perror("Error is");
}
----------------------------------------------------------------------------------
The output for the code is:
Before rmdir errno is 0
After rmdir errno is 0
result is -1
None of the above
The error is 0
Error is: Invalid argument
This is the output shown when rmdir does not successfully remove my directory. This happens when the directory given is actually there. Errno still prints out to zero but perror shows an error. This makes no sense to me. Has anyone came across a problem like this before? I have already asked another software engineer and he has already given up on this problem. I am frustrated and would like to resolve this.
Any help is greatly appreciated.