代码改变世界

C++ 字符串分割

2013-05-08 22:28 by 每天努力一点点, 180 阅读, 0 推荐, 收藏,
摘要:#include #include #include #include #pragma hdrstop#pragma argsusedusing namespace std;typedef basic_string::size_type S_T;static const S_T npos = -1;vector split( const string & src, string delimit, string null_subst = "" ){if ( src.empty() || delimit.empty() )throw "split: empty 阅读全文

C++ builder 通过WMI查询网卡对应的序号

2013-03-12 21:56 by 每天努力一点点, 341 阅读, 0 推荐, 收藏,
摘要:#pragma hdrstop#include #include #include using namespace std;#pragma argsusedint getAdapterIndex(String adapterName) {int adapterIndex = -1;BSTR resPath = L"root\\cimv2";// Initialize COMHRESULT hres;// hres = CoInitializeEx(0, COINIT_MULTITHREADED);// if (FAILED(hres)) {// return 1;// }/ 阅读全文

正则表达式校验IP地址

2013-03-01 22:35 by 每天努力一点点, 1003 阅读, 0 推荐, 收藏,
摘要:#include #include bool isIPValid(UnicodeString ipStr){char ipAddrPattern[]="^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$"; const char *pszErr; int nErrOffset;pcre *re = pcre_compile(ipAddrPattern,0,&pszErr,&nErrOffset,NUL 阅读全文

lphlpapi iphelper新增/删除IP地址

2013-02-24 22:04 by 每天努力一点点, 509 阅读, 0 推荐, 收藏,
摘要:转自:http://msdn.microsoft.com/en-us/library/windows/desktop/aa365801(v=vs.85).aspx#pragma comment(lib, "iphlpapi.lib")#pragma comment(lib, "ws2_32.lib")#include #include #include #include #define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x))#define FREE(x) HeapFree(GetProcessHeap( 阅读全文

vb wmi 修改ip地址、网关、DNS

2013-02-24 21:26 by 每天努力一点点, 699 阅读, 0 推荐, 收藏,
摘要:strComputer="."Set objWMIService=GetObject("winmgmts:\\" & strComputer & "\root\cimv2")Set colNetAdapters=objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where settingid='{E48F71A7-9AD4-4CD0-9ED9-A7BFD79AA056}'") '前 阅读全文

C++ builder 通过WMI方式修改DNS

2013-02-20 22:43 by 每天努力一点点, 688 阅读, 0 推荐, 收藏,
摘要:#pragma hdrstop#include using namespace std;#include #pragma comment(lib, "wbemUuid2.lib")#pragma argsusedvoid PrintWMIError(HRESULT hr);HRESULT modifyDNS() {HRESULT hr;hr = CoInitializeEx(0, COINIT_MULTITHREADED);hr = CoInitializeSecurity(NULL, -1, NULL, NULL,RPC_C_AUTHN_LEVEL_PKT_PRIVACY 阅读全文

c语言 vector使用样例

2012-12-08 20:43 by 每天努力一点点, 657 阅读, 0 推荐, 收藏,
摘要:#include "stdafx.h"#include #include #include using namespace std;int main(void){ vector ve1; ve1.push_back("123"); vector::iterator it1; char* elem="123"; it1 = find(ve1.begin(), ve1.end(), elem); cout<<*it1;} 阅读全文

C语言 获取系统临时目录并获取临时文件名

2012-12-08 20:32 by 每天努力一点点, 674 阅读, 0 推荐, 收藏,
摘要:char tempFileName[MAX_PATH]; char sysTempPath[MAX_PATH+1]; GetTempPath (MAX_PATH,sysTempPath); GetTempFileName(sysTempPath,"rar",0,tempFileName); 阅读全文

C语言 写文件样例

2012-12-08 20:31 by 每天努力一点点, 196 阅读, 0 推荐, 收藏,
摘要:HANDLE hf = CreateFile("d:/a.txt",GENERIC_WRITE | GENERIC_READ,FILE_SHARE_WRITE,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL); DWORD dwCount; char* str ="test\r\n"; int len =strlen(str); WriteFile(hf, str, len, &dwCount, NULL);CloseHandle(hf); 阅读全文

C语言List使用样例

2012-12-08 20:30 by 每天努力一点点, 1489 阅读, 0 推荐, 收藏,
摘要:#include #include #include #include using namespace std;//创建一个list容器的实例LISTCHARtypedef list LISTCHAR;int main(int argc, char* argv[]){ //用LISTCHAR创建一个名为listOne的list对象 LISTCHAR listTwo; //声明i为迭代器 LISTCHAR::iterator j; //从前面向listTwo容器中添加数据 listTwo.push_front ("A123"); listTwo.push_front (&qu 阅读全文
上一页 1 ··· 4 5 6 7 8 9 10 下一页