c++ - 如何将字符串转换为 xmlChar

标签 c++ type-conversion libxml2

我正在尝试将字符串转换为 xmlChar。编译器表示不存在从 const string 到 xmlChar 的合适转换函数。代码如下所示:

bool ClassName::openFile(const String& ZipFile)
{
    //convert 
    const xmlChar *temp = (const xmlChar)ZipFile; //ZipFile has an error here. ZipFile is path and filename
    ...
}

有什么想法吗?我用谷歌搜索了一下,人们正在从 xmlChar 转换为字符串,但不是这个方向。

最佳答案

xmlChar 只是 unsigned char 的 typedef。就这样写你的句子:

const xmlChar *temp = ZipFile.c_str();

关于c++ - 如何将字符串转换为 xmlChar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26765562/

相关文章:

r - 将空白元素解释为 R 函数 Factor() 中的有效因子元素的好处?

c# - 在C#中将MAC地址转换为字节数组

delphi - libxml2 xmlParseFile无法加载格式正确的XML

c - libxml xmlXPathEvalExpression顺序

c++ - Char 的大小与字符串不同

c++ - clang 编译器发出的错误 "bash: line 7: 4913 Killed"是什么?

python - 使用 Conda 安装 OpenCV

rust - 如何在 Rust 中使用 From trait 实现双向转换?

c++ - 复制构造函数和转发构造函数之间的冲突

java - 来自 java 的 libxml2