Working on a command line tool and i'm getting a confusing error.
Here's the code:
FileRec::move( const std::string dir ) const {
std::list<std::string>::const_iterator it = matches.begin();
if ( !rename( (dir+*it).c_str(), (target+*it).c_str() ) ) {
std::cout << "error moving file " << *it << " errno:" << errno << std::endl;
}
}
The errno return is 9 which is a Bad File Descriptor. Whats confusing me is that even though it errors it still renames the file(s).