]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/filesystem/example/tchar.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / filesystem / example / tchar.cpp
1 // Example use of Microsoft TCHAR ----------------------------------------------------//
2
3 // Copyright Beman Dawes 2008
4
5 // Distributed under the Boost Software License, Version 1.0.
6 // See http://www.boost.org/LICENSE_1_0.txt
7
8 #include <boost/filesystem/path.hpp>
9 #include <boost/filesystem/operations.hpp>
10 #include <string>
11 #include <cassert>
12 #include <windows.h>
13 #include <winnt.h>
14
15 namespace fs = boost::filesystem;
16
17 typedef std::basic_string<TCHAR> tstring;
18
19 void func( const fs::path & p )
20 {
21 assert( fs::exists( p ) );
22 }
23
24 int main()
25 {
26 // get a path that is known to exist
27 fs::path cp = fs::current_path();
28
29 // demo: get tstring from the path
30 tstring cp_as_tstring = cp.string<tstring>();
31
32 // demo: pass tstring to filesystem function taking path
33 assert( fs::exists( cp_as_tstring ) );
34
35 // demo: pass tstring to user function taking path
36 func( cp_as_tstring );
37
38 return 0;
39 }