gpt4 book ai didi

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

转载 作者:搜寻专家 更新时间:2023-10-31 01:42:29 26 4
gpt4 key购买 nike

我正在尝试将字符串转换为 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 的类型定义。把你的句子写成这样:

const xmlChar *temp = ZipFile.c_str();

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

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