Sample Code
CCLOG (“Characters: %c %c
”, ‘a’, 65);
CCLOG (“Decimals: %d %ld
”, 1977, 650000L);
CCLOG (“Preceding with blanks: %10d
”, 1977);
CCLOG (“Preceding with zeros: %010d
”, 1977);
CCLOG (“Some different radixes: %d %x %o %#x %#o
”, 100, 100, 100, 100, 100);
CCLOG (“floats: %4.2f %+.0e %E
”, 3.1416, 3.1416, 3.1416);
CCLOG (“Width trick: %*d
”, 5, 10);
CCLOG (“%s
”, “A string”);
Output
Cocos2d: Characters: a A
Cocos2d: Decimals: 1977 650000
Cocos2d: Preceding with blanks: 1977
Cocos2d: Preceding with zeros: 0000001977
Cocos2d: Some different radixes: 100 64 144 0x64 0144
Cocos2d: floats: 3.14 +3e+00 3.141600E+00
Cocos2d: Width trick: 10
Cocos2d: A string