I was trying to use a CCString with printf and it was not working and it took me quite a while to find the information I needed to get it to work, so thought I would post solution here for other newbies. I am sure this may be common knowledge for some of you but took me a couple hours to figure out what I needed to do!
So this is example of what I tried to do:
CCString* myVar = (CCString*)"Hello"; printf("myVar var = %s \n", myVar);
But the printf gives the following error:
Format specifies type 'char *' but the argument has type 'cocos2d::CCString *'
So solution is to convert CCString myVar to char using ->getCString like this:
CCString* myVar = (CCString*)"Hello"; printf("myVar var = %s \n", myVar->getCString());
To use std::string with printf use this:
printf("myStdVar var = %s \n", myStdVar.c_str() );