[ create a new paste ] login | about

Project: boost
Link: http://boost.codepad.org/nmwVlgta    [ raw code | output | fork ]

C++, pasted on Sep 23:
#define BOOST_FILESYSTEM_VERSION 2

#include <iostream>

#include <boost/assert.hpp>
#include <boost/filesystem.hpp>

using namespace boost;
using namespace std;

int main( int argc, char* argv[] ) {
//teste 1 -> that doenst work
  string filename;

  cout << "Path: ";
  cin >> filename; //I pass "C:/ó.ego"

  filesystem::path filename2 = filesystem::system_complete(
      filesystem::path( filename, filesystem::native ) );
  if ( ! filesystem::exists( filename2 ) ) {
    cout << "Directory not found: ";
  } else {
    cout << "Directory found: ";
  }
  cout << filename2.string() << endl << endl;

//teste 2 -> that works fine

  filename = "C:\\ó.ego";

  filename2 = filesystem::system_complete(
      filesystem::path( filename, &filesystem::native ) );
  if ( ! filesystem::exists( filename2 ) ) {
    cout << "Directory not found: ";
  } else {
    cout << "Directory found: ";
  }

  cout << filename2.string() << endl; 
}
/*
INPUT:
C:/ó.ego

OUTPUT:
Path: C:\ó.ego
Directory not found: C:/ó.ego

Directory found: C:/¾.ego
Pressione qualquer tecla para continuar. . .
*/


Output:
1
2
3
4
In function `boost::filesystem::basic_path<std::string, boost::filesystem::path_traits> boost::filesystem::current_path<boost::filesystem::basic_path<std::string, boost::filesystem::path_traits> >()':
t.cpp:(.gnu.linkonce.t._ZN5boost10filesystem12current_pathINS0_10basic_pathISsNS0_11path_traitsEEEEET_v+0x29): undefined reference to `boost::filesystem::detail::get_current_path_api(std::string&)'
In function `boost::enable_if<boost::filesystem::is_basic_path<boost::filesystem::basic_path<std::string, boost::filesystem::path_traits> >, bool>::type boost::filesystem::exists<boost::filesystem::basic_path<std::string, boost::filesystem::path_traits> >(boost::filesystem::basic_path<std::string, boost::filesystem::path_traits> const&)':
t.cpp:(.gnu.linkonce.t._ZN5boost10filesystem6existsINS0_10basic_pathISsNS0_11path_traitsEEEEENS_9enable_ifINS0_13is_basic_pathIT_EEbE4typeERKS7_+0x162): undefined reference to `boost::filesystem::detail::status_api(std::string const&, int&)'


Create a new paste based on this one


Comments: