摘要: 1. ntohs 使用ntohs之类的函数,需要加载Ws2_32.lib链接库,并引用Winsock2.h头文件 2. _timeb 使用_timeb需要引用的头文件包括: #include <sys/types.h> #include <sys/timeb.h> 阅读全文
posted @ 2023-06-15 18:03 中班小小石 阅读(42) 评论(0) 推荐(0)
摘要: 1. 隐藏窗体 BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; cs.style = WS_POPUP;//使主窗口不可见 cs.dwEx 阅读全文
posted @ 2023-06-15 18:01 中班小小石 阅读(24) 评论(0) 推荐(0)
摘要: VC6中的for语句不规范,循环变量在for循环外还可以使用,可以在预编绎头文件stdafx.h中加入如下语句完成for语句的规范化, #define for if(0); else for 阅读全文
posted @ 2023-06-15 18:00 中班小小石 阅读(41) 评论(0) 推荐(0)
摘要: int year = 0; int month = 0; int day = 0; sscanf((char*)strDateInfo,"%4d%2d%2d",&year, &month, &day); struct tm paraTime = { 0, 0, 0, day, month - 1, 阅读全文
posted @ 2023-06-15 17:59 中班小小石 阅读(136) 评论(0) 推荐(0)
摘要: 传入参数:string name string fileName; fileName.resize(MAX_PATH); ::GetModuleFileName(NULL, const_cast<char*>(fileName.c_str()), MAX_PATH); fileName = file 阅读全文
posted @ 2023-06-15 17:58 中班小小石 阅读(17) 评论(0) 推荐(0)
摘要: 只有以NULL结尾的char[]才能强制转换为CString,即可以直接等于,否则需要通过Format函数 char charArray[]="this C++"; CString res; res.Format("%s", charArray); 阅读全文
posted @ 2023-06-15 17:56 中班小小石 阅读(46) 评论(0) 推荐(0)
摘要: CString转string CString strMfc = "test"; std::string strStr = strMfc.GetBuffer(0); string转CString CString strMfc; string strStr = "test"; strMfc = strS 阅读全文
posted @ 2023-06-15 17:55 中班小小石 阅读(50) 评论(0) 推荐(0)
摘要: string转char数组 char buf[10]; string str("ABCDEFG"); length = str.copy(buf, 9); buf[length] = '\0'; 或者 strcpy(buf, str.c_str()); strncpy(buf, str.c_str( 阅读全文
posted @ 2023-06-15 17:54 中班小小石 阅读(34) 评论(0) 推荐(0)
摘要: char timeInfo[256]; memset(timeInfo, 0, sizeof(timeInfo)); sprintf(timeInfo, "%04d/%02d/%02d %02d:%02d:%02d ", year,mon,day, hour, min, sec); 1)sscanf 阅读全文
posted @ 2023-06-15 17:53 中班小小石 阅读(290) 评论(0) 推荐(0)
摘要: 截取函数实现 void GetSubStrings(const string& totalStr, const string& delim, vector<string>& res) { res.clear(); if (totalStr == "") { return ; } char *strA 阅读全文
posted @ 2023-06-15 17:31 中班小小石 阅读(35) 评论(0) 推荐(0)