By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,017 Members | 1,158 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,017 IT Pros & Developers. It's quick & easy.

Remove a UNIX hidden file using boost::filesystem

P: n/a
Hello all,

I'm trying to remove a hidden file (in UNIX) using the
Boost::filesystem library.
This is what I have:
#include <boost/filesystem/operations.hpp>

namespace fs=boost::filesystem;

my_func()
{
fs::remove(fs::path("/path/to/.hiddenfile")); // this file
exists, and I have permissions to write it
}
And I get this error:
terminate called after throwing an instance of
'boost::filesystem::filesystem_error'
what(): boost::filesystem::path: invalid name ".hiddenfile" in
path: "/path/to/.hiddenfile"
Do you know what is wrong?
Is there any other way for doing this?

Thanks.

Oct 5 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Fri, 05 Oct 2007 03:55:27 -0700, Javier wrote:
I'm trying to remove a hidden file (in UNIX) using the
Boost::filesystem library.
Your question is not relevant to the C++ language in general,
but it covers an issue with the boost::filesystem library.
Check for support groups of boost::filesystem instead.
The comp.lang.c++ group is for C++ language issues.

--
Joel Yliluoma - http://bisqwit.iki.fi/
: comprehension = 1 / (2 ^ precision)
Oct 5 '07 #2

P: n/a
On Fri, 05 Oct 2007 03:55:27 -0700, Javier wrote:
Hello all,

I'm trying to remove a hidden file (in UNIX) using the Boost::filesystem
library.
This is what I have:
#include <boost/filesystem/operations.hpp>

namespace fs=boost::filesystem;

my_func()
{
fs::remove(fs::path("/path/to/.hiddenfile")); // this file
exists, and I have permissions to write it }
And I get this error:
terminate called after throwing an instance of
'boost::filesystem::filesystem_error'
what(): boost::filesystem::path: invalid name ".hiddenfile" in
path: "/path/to/.hiddenfile"
Do you know what is wrong?
Is there any other way for doing this?
Not sure whether that has anything to do with your problem but to delete
a file on UNIX and UNIX-like systems you usually need write permissions
to the directory the file is in not the file itself (unless the sticky
bit is set on the directory).

--
Markus Schoder
Oct 5 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.