$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-users] filesystem3::rename error codes
From: Andreas Haferburg (ahaferburg_at_[hidden])
Date: 2011-06-29 06:44:29
Greetings,
I was wondering how to handle errors of filesystem3::rename(). I'd like 
to use the system::error_code& overload, but I can't seem to find out 
how to use it. The documentation at [1] points to POSIX rename(), so I'm 
guessing the error_code somehow corresponds to the POSIX rename() return 
value. I'm not a native speaker, but I find the documentation pretty 
vague here. The tutorial section [2] doesn't help either.
For example if the target file doesn't exist, the error_code.value() is 
3. But I'm not supposed to use the constant 3 in the code, am I? Are 
there any constants defined that correspond to these error code values? 
What's the proper way to do the following:
TEST( BoostFilesystem3Test, testRenameFails )
{
   boost::system::error_code ec;
   boost::filesystem3::rename("c:/does/not/exist", "asdf", ec);
   ASSERT_EQ(3, ec.value());
}
I'm going to use QFile for now, but only because their documentation is 
(slightly) better. I would like to use boost for as much as possible, so 
an explanation or pointers to better documentation would be much 
appreciated. Thank you.
Best regards
Andreas
P.S. I accidentally sent this mail to the boost@ list before, sorry 
about that.
[1]
http://www.boost.org/doc/libs/1_46_1/libs/filesystem/v3/doc/reference.html#rename
[2]
http://www.boost.org/doc/libs/1_46_1/libs/filesystem/v3/doc/tutorial.html#Error-reporting