gpt4 book ai didi

c++ - boost::filesystem::path 与 boost::filesystem::wpath

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:28:34 27 4
gpt4 key购买 nike

Boost 库有一个类来处理文件路径:boost::filesystem::path。Boos 也有这个类 boost::filesystem::wpath

每个类都有方法string(), wstring(), c_str(), native()

我开发 Windows 应用程序,我完全不明白我应该使用什么 ))

从实用的角度来看,这两个类有什么区别?这些方法有什么区别?

我应该为 Windows 应用程序使用什么类和什么方法? ::wpathwstring() 无处不在?

部分源代码(几个静态链接库)将为 Ubuntu 编译。在这种情况下 ::wpath 还好吗?


我还使用 SQLite 并且它需要数据库文件的路径。 sqlite3_open .

我应该使用sqlite3_open_v2(文件路径的UTF-8编码)还是sqlite3_open16(文件路径的UTF-16编码)?


附言看完这篇文章link似乎 ::path::wpath 完全没有区别。对吗?

方法native() 似乎更适合为不同平台编译的源代码。

最佳答案

What is the difference between these two classes from the practical point of view? What is the difference between these methods?

What class and what methods should I use for Windows app? ::wpath and wstring() everywhere?

值得一提的是,对于现在的几个版本,Boost 已经弃用了 wpath,而应该使用 class path。参见 Boost Deprecated Features (current release)

“在引擎盖下”,Boost 使用 std::stringstd::wstring 表示 pathwpath code> 其中wstring用于表示宽字符串,即支持更大的字符集。

大部分问题都在这里得到解答:std::wstring VS std::string

Method native() seems preferable for the source code that compiled for different platforms

没错。如果它只是您正在开发的 Windows 应用程序,则可以在 native()

上使用 wstring()

关于c++ - boost::filesystem::path 与 boost::filesystem::wpath,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35525611/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com