积木

No sub title

  C++博客 :: 首页 :: 联系 :: 聚合  :: 管理
  140 Posts :: 1 Stories :: 11 Comments :: 0 Trackbacks

常用链接

留言簿(1)

我参与的团队

搜索

  •  

最新评论

阅读排行榜

评论排行榜

 1 void CLogService::kkLog2(const char* pszName, const char* fmt, ) {
 2     cocos2d::CCFileUtils *pCCFileUtils = cocos2d::CCFileUtils::sharedFileUtils();
 3 #if defined(WIN32) || defined(_WIN32)
 4     SSString path = getExePath().c_str();
 5     path += "log/";
 6 #elif defined(IOS) || defined(__APPLE__)
 7     SSString path = pCCFileUtils->getWritablePath();
 8     path += "log/";
 9 #else
10     SSString path = "/mnt/sdcard/external-sd/";
11 #endif
12 
13     SSString filename = path + pszName;
14 
15     va_list ap;
16     va_start(ap, fmt);
17     char buf[1024];
18     vsprintf(buf, fmt, ap);
19     va_end(ap);
20 
21     std::string strTime;
22     ___getTime(strTime);
23     strTime += "    ";
24 
25 #if defined(_WIN32) || defined(WIN32)
26     std::string strLogText = strTime + buf + "\r\n";
27     ::OutputDebugStringA((LPCSTR)strLogText.c_str());
28 #endif
29 
30     // ensure the path is exist
31     _create_dir(path.c_str());
32 
33     FILE *fp = fopen(filename.c_str(), "ab+");
34     if(fp) {
35         fwrite(strTime.c_str(), strTime.length(), 1, fp);
36         fwrite(buf, strlen(buf), 1, fp);
37         fputs("\r\n", fp);
38         fclose(fp);
39     }
40 }
posted on 2014-11-13 10:43 Jacc.Kim 阅读(725) 评论(0)  编辑 收藏 引用 所属分类: 游戏

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理