变长参数的函数写法
2011-04-26 10:18
197 查看
//***************************************************************************************** // Template No. SWF0012 Template Version No. 04.04.00 // //***************************************************************************************** // FUNCTION NAME : PrintLog() // //-------------------------------------------------- PURPOSE ----------------------------------------- // // Print a text in log file //---------------------------------------- $$ REQUIREMENTS $$ ---------------------------------------- // // Format: $${TAG} R[#][Prod. ID]:Specification Path // // $$: ISGcq00622453 // TAG: [APP_GEN] // R #: R[29] // Prod.ID: // Spec. Path: /vob/ // // // //-------------------- PSEUDO CODE / DETAILED FUNCTION DESCRIPTION ------------------- // // Creates a log file with the phone info // //------------------------------------------------ REVISIONS ------------------------------------------ // Date Name Tracking # Description // --------- ------------------- ------------- ------------------------------ // 26ARP2011 Feng Liu ISGcq00622453 Initial Creation //***************************************************************************************************** // //----------------------------------------- FUNCTION DEFINITION --------------------------------------- void FeatureDisableDlg::PrintLog(CString& message) { if(APPLICATION_VERSION[0] != 'R') { try { //verify if it is already opened if (m_logFile.m_hFile == CFile::hFileNull) { if(m_logFile.Open(LOG_FILE_NAME, CFile::modeCreate | CFile::modeNoTruncate | CFile::modeWrite)) { m_logFile.SeekToEnd(); CString log; log.Format("=====================================================\n",log); time_t rawtime; time ( &rawtime ); char timeStr[0x100]; if(!ctime_s(timeStr, 0x100, &rawtime)) { log.Format("Execution date: %s", timeStr); } else { log.Format("Execution date: %s", "Can not read the time."); } m_logFile.Write(log, log.GetLength()); } } m_logFile.Write(message, message.GetLength()); } catch (...) { } } }void FeatureDisableDlg::PrintLog(const char* message, ...) { // if(APPLICATION_VERSION[0] != 'R') if(1) { va_list list; va_start(list, message); char szBuffer[MAX_OUTPUT_TEXT_SIZE]; _vsnprintf_s(szBuffer, sizeof(szBuffer), message, list); CString log(szBuffer); PrintLog(log); va_end(list); } } 发表于 @ 2011年04月26日 10:13:00 | 评论( 0 ) | 编辑| 举报| 收藏 本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/asiainfolf/archive/2011/04/26/6363397.aspx
相关文章推荐
- ATL COM中IDL文件里定义函数有默认值的参数的写法
- thinkphp3.2 后台获取app前端多个图片上传及参数 的接口写法(upload()函数)
- 2.不定个数参数的函数写法
- 变长参数的函数写法
- 可变长参数的函数的写法
- c语言中参数列表可变的函数写法,如printf
- PHP开发:包含不定数量参数的函数写法
- 【JavaScript】a标签onclick传递参数不对,A标签调用js函数写法总结
- iOS 定义多个参数函数的写法
- python:函数中五花八门的参数形式(茴香豆的『回』字有四种写法)
- 传不定个数参数的函数写法
- 基础知识_带参数函数写法,蜂鸣器,继电器
- c语言多参数函数写法
- 不定参数个数函数写法
- 发现 IOS 如UIButton 事件处理函数参数和不带参数写法不一样
- PHP开发:包含不定数量参数的函数写法
- c语言qsort()函数中compare()函数参数写法
- 可变长参数函数写法
- 带有任意个参数的函数写法(1)
- C++程序设计语言练习7.3 函数不定个数参数的写法和多参数处理接口