2
문자열을 xmlChar로 변환하려고합니다. 컴파일러는 const 문자열에서 xmlChar 로의 적절한 변환 함수가 존재하지 않는다고 말합니다. 이 코드는 다음과 같습니다.문자열을 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에서 문자열로 변환했지만이 방향은 아닙니다.
,' –
는 C++과 C 스타일 캐스트를 사용하여 이후되고 가난한 코딩 스타일로 눈살을 찌푸리게한다 그것은 결함의 근원이다. 나는 당신이'const xmlChar * temp = (const xmlChar *) ZipFile.c_str();'과 같은 것을하고 싶다고 생각한다. [std :: string을 const char 또는 char로 변환하는 방법 참조] (http://stackoverflow.com/questions/347949/how-to-convert-a-stdstring-to-const-char-or-char) –
String 및 xmlChar의 정의를 제공하지 않으면 대답 할 수 없습니다. – antred