Boost logo

Boost Users :

From: richard_fanta (richard.fanta_at_[hidden])
Date: 2003-06-26 12:05:20


Hiya,

I've been trying to try out the attributes code in the boost-sandbox,
but am running into some snags using VC++ version 7 (that comes with
VS .NYET).

One simple goal here would be to discern whether a file is writeable.
 Can this be done with the filesystem::attributes library??

The code for attr_test.cpp from the tests directory is included below;
it's been slightly modified to run stand-alone instead of through the
boost test harness.

Problem #1: No string() method on the cache class.

Problem #2: The "<<" operator won't work.

For the latter, I've seen it suggested that typedefs might help, but
don't understand what the underlying issue is. Is this a lingering
Microsoft (i.e. VC++) specific issue? I'd greatly appreciate any
clarification that people can offer.

Much thanks,
Richard Fanta

----------------Errors----------------------------------------------
x:\v\ReviewAgent\AttrTest\attr_test.cpp(23) : error C2039: 'string' :
is not a member of 'boost::filesystem::cache'
       
x:\ReviewAgent\Util\boost_1_30_0_filesystem\boost\filesystem\cache.hpp(33)
: see declaration of 'boost::filesystem::cache'
x:\v\ReviewAgent\AttrTest\attr_test.cpp(25) : error C2676: binary '<<'
: 'boost::filesystem::cache' does not define this operator or a
conversion to a type acceptable to the predefined operator
x:\v\ReviewAgent\AttrTest\attr_test.cpp(26) : error C2676: binary '<<'
: 'boost::filesystem::cache' does not define this operator or a
conversion to a type acceptable to the predefined operator
x:\v\ReviewAgent\AttrTest\attr_test.cpp(26) : error C2676: binary '<<'
: 'boost::filesystem::cache' does not define this operator or a
conversion to a type acceptable to the predefined operator

----------------Source----------------------------------------------
#include <iostream>
#include <exception>
#include <string>

#include "boost/filesystem/attributes.hpp"
#include "boost/filesystem/path.hpp"
//#include "boost/test/minimal.hpp"

namespace fs = boost::filesystem;

//int test_main (int argc, char **argv)
int main (int argc, char **argv)
{
  for (int i = 1; i < argc; ++i) {
    fs::path file (argv [i], fs::native);
    fs::cache pm (file);
    std::cout //<< "name: " << get <fs::filename> (pm).string ()
      << "; size: " << get <fs::size> (pm)
      << "; owner: " << get <fs::owner> (pm)
      << "; group: " << get <fs::group> (pm) << "\n";
}


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net