-
igorppbrLikes 0Problem Description
Hello,
I trying to use c_str() in a string in cocos2dx.
In Sprite::Create() and in CCLOG() I can pass a const char value. I have a string and Im trying to get the const char value to pass in these methods, but I trying to use c_str() and not work.
I tested this:
std::string _test("sprite1.png");
const char _char = _test.c_str();
CCLOG("my test %s",_char);But I get: “error: invalid conversion from 'const char*' to 'char' [-fpermissive]”
How I can get the const char value?
-
Sonar Systems adminLikes 0
Why are you using a const char?
-
igorppbrLikes 0
In CCLOG and in Sprite::Create I have to use a const char, or not?
I have a std::string and I need to use the string value in these methods.
-
Sonar Systems adminLikes 1
No, use a cocos2d::__String
This reply has been verified.
Login to reply