本文来自http://blog.csdn.net/u012972188 ,引用必须注明出处!
如何使用 CCLOG(NSlog)
温馨提醒:使用二维码扫描软件,就可以在手机上访问我的博客啦!另外大家可以访问另一个博客http://blog.csdn.net/runaying
各种参数;
实例代码;
需要说明的是 %x,%o 分别是 16 进制 8进制
1CCLOG ("Characters: %c %c \n", 'a', 65);
2CCLOG ("Decimals: %d %ld\n", 1977, 650000L);
3CCLOG ("Preceding with blanks: %10d \n", 1977);
4CCLOG ("Preceding with zeros: %010d \n", 1977);
5CCLOG ("Some different radixes: %d %x %o %#x %#o \n", 100, 100, 100, 100, 100);
6CCLOG ("floats: %4.2f %+.0e %E \n", 3.1416, 3.1416, 3.1416);
7CCLOG ("Width trick: %*d \n", 5, 10);
8CCLOG ("%s \n", "A string");
输出结果
1Cocos2d: Characters: a A
2
3Cocos2d: Decimals: 1977 650000
4
5Cocos2d: Preceding with blanks: 1977
6
7Cocos2d: Preceding with zeros: 0000001977
8
9Cocos2d: Some different radixes: 100 64 144 0x64 0144
10
11Cocos2d: floats: 3.14 +3e+00 3.141600E+00
12
13Cocos2d: Width trick: 10
14
15Cocos2d: A string