diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
commit | 19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch) | |
tree | 42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/boost/libs/filesystem/example/tchar.cpp | |
parent | Initial commit. (diff) | |
download | ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip |
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/filesystem/example/tchar.cpp')
-rw-r--r-- | src/boost/libs/filesystem/example/tchar.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/boost/libs/filesystem/example/tchar.cpp b/src/boost/libs/filesystem/example/tchar.cpp new file mode 100644 index 000000000..5f33d69e0 --- /dev/null +++ b/src/boost/libs/filesystem/example/tchar.cpp @@ -0,0 +1,39 @@ +// Example use of Microsoft TCHAR ----------------------------------------------------// + +// Copyright Beman Dawes 2008 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +#include <boost/filesystem/path.hpp> +#include <boost/filesystem/operations.hpp> +#include <string> +#include <cassert> +#include <windows.h> +#include <winnt.h> + +namespace fs = boost::filesystem; + +typedef std::basic_string<TCHAR> tstring; + +void func( const fs::path & p ) +{ + assert( fs::exists( p ) ); +} + +int main() +{ + // get a path that is known to exist + fs::path cp = fs::current_path(); + + // demo: get tstring from the path + tstring cp_as_tstring = cp.string<tstring>(); + + // demo: pass tstring to filesystem function taking path + assert( fs::exists( cp_as_tstring ) ); + + // demo: pass tstring to user function taking path + func( cp_as_tstring ); + + return 0; +} |