这篇教程C++ strnicmp函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中strnicmp函数的典型用法代码示例。如果您正苦于以下问题:C++ strnicmp函数的具体用法?C++ strnicmp怎么用?C++ strnicmp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了strnicmp函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: Str_MakeFilePathbool CTaksiConfig::ReadIniFile(){ // Read an INI file in standard INI file format. // Returns true if successful. TCHAR szIniFileName[_MAX_PATH]; Str_MakeFilePath( szIniFileName, COUNTOF(szIniFileName), sg_Shared.m_szIniDir, _T(TAKSI_INI_FILE) );#ifdef _UNICODE // convert from UNICODE. fopen() is multibyte only. FILE* pFile = NULL; ASSERT(0);#else FILE* pFile = fopen(szIniFileName, _T("rt"));#endif if (pFile == NULL) { // ASSUME constructor has already set this to all defaults. return false; } LOG_MSG(( "Reading INI file '%s'" LOG_CR, szIniFileName )); CIniObject* pObj = NULL; while (true) { char szBuffer[_MAX_PATH*2]; fgets(szBuffer, sizeof(szBuffer)-1, pFile); if (feof(pFile)) break; // skip/trim comments char* pszComment = strstr(szBuffer, ";"); if (pszComment != NULL) pszComment[0] = '/0'; // parse the line char* pszName = Str_SkipSpace(szBuffer); // skip leading spaces. if ( *pszName == '/0' ) continue; if ( *pszName == '[' ) { if ( ! strnicmp( pszName, "[" TAKSI_SECTION "]", 7 )) { pObj = this; } else if ( ! strnicmp( pszName, "[" TAKSI_CUSTOM_SECTION " ", sizeof(TAKSI_CUSTOM_SECTION)+1 )) { TCHAR szSection[ _MAX_PATH ];#ifdef _UNICODE ASSERT(0);#else strncpy( szSection, pszName+sizeof(TAKSI_CUSTOM_SECTION)+1, sizeof(szSection));#endif TCHAR* pszEnd = _tcschr(szSection, ']'); if (pszEnd) *pszEnd = '/0'; pObj = CustomConfig_Lookup(szSection,true); } else { pObj = NULL; LOG_MSG(("INI Bad Section %s" LOG_CR, pszName )); } continue; } if ( pObj == NULL ) // skip continue; char* pszEq = strstr(pszName, "="); if (pszEq == NULL) continue; pszEq[0] = '/0'; char* pszValue = Str_SkipSpace( pszEq + 1 ); // skip leading spaces. if ( ! pObj->PropSetName( pszName, pszValue )) { LOG_MSG(("INI Bad Prop %s" LOG_CR, pszName )); } } fclose(pFile); FixCaptureDir(); return true;}
开发者ID:Jimallan,项目名称:CxlCap,代码行数:88,
示例2: loadParamvoid ConfigIO :: loadParam (const char *param){ char line [10240]; char paramName [10240]; strncpy_s (line, param, sizeof (line)); char *div = strchr (line, '='); for (size_t f = 0; f < parameters.size (); f ++) { strcpy_s (paramName, parameters [f].name); trimWhiteSpace (paramName); if (strnicmp (paramName, line, strlen (paramName)) == 0) { if (parameters [f].type == INT) *parameters [f].pInt = atoi (div + 1); if (parameters [f].type == UNSIGNED) *parameters [f].pUnsigned = atoi (div + 1); if (parameters [f].type == BOOL) { std::string boolValue = std::string(div+1); if (boolValue.compare("true") == 0) *parameters [f].pBool = true; else if (boolValue.compare("false") == 0) *parameters [f].pBool = false; else { *parameters [f].pBool = !! atoi (div + 1); } } if (parameters [f].type == DOUBLE) *parameters [f].pDouble = atof (div + 1); if (parameters [f].type == STRING) {// if (div [1] != '"') continue;// if (strchr (div + 2, '"') == NULL) continue;// *strchr (div + 2, '"') = '/0';// *parameters [f].pString = div + 2; if (div [1] == '"') { if (strchr (div + 2, '"') == NULL) continue; *strchr (div + 2, '"') = '/0'; *parameters [f].pString = div + 2; } else if (div [1] == '/'') { if (strchr (div + 2, '/'') == NULL) continue; *strchr (div + 2, '/'') = '/0'; *parameters [f].pString = div + 2; } else { // for (char *p = div + 2; *p != '/0'; p ++) // already trimmed// if (isspace (*p)) *p = '/0'; *parameters [f].pString = div + 1; } } if (parameters [f].type == ENUM) { if (strtol(div+1, (char **)NULL, 10)==0) { // it is not a number if (parameters [f].enum_map->is_valuename(div+1)) *parameters [f].pInt = parameters [f].enum_map->get_value(div+1); else printf("Warning: Invalid enum value name '%s' of '%s', leaving default value./n", div+1, parameters [f].name); // leave default value_type } else *parameters [f].pInt = atoi (div + 1); } } } for (size_t f = 0; f < checks.size (); f ++) { strcpy_s (paramName, checks [f].name); trimWhiteSpace (paramName); if (strnicmp (paramName, line, strlen (paramName)) == 0) { if (checks [f].type == INT) { int v = atoi (div + 1); if (checks [f].vInt != v) cerr << "Config-file parameter " << paramName << " (" << v << ") does not match to compile time value " << checks [f].vInt << endl; assert (checks [f].vInt == v); } if (checks [f].type == UNSIGNED) { unsigned v = atoi (div + 1); if (checks [f].vUnsigned != v) cerr << "Config-file parameter " << paramName << " (" << v << ") does not match to compile time value " << checks [f].vUnsigned << endl; assert (checks [f].vUnsigned == v); } if (checks [f].type == BOOL) { bool v = !! atoi (div + 1); if (checks [f].vBool != v) cerr << "Config-file parameter " << paramName << " (" << v << ") does not match to compile time value " << checks [f].vBool << endl; assert (checks [f].vBool == v); } if (checks [f].type == DOUBLE) { double v = atof (div + 1); if (checks [f].vDouble != v) cerr << "Config-file parameter " << paramName << " (" << v << ") does not match to compile time value " << checks [f].vDouble << endl; assert (checks [f].vDouble == v); }//.........这里部分代码省略.........
开发者ID:amkhader,项目名称:PokerfaceTest,代码行数:101,
示例3: ADDTOCALLSTACKbool CItemStone::r_GetRef( LPCTSTR & pszKey, CScriptObj * & pRef ){ ADDTOCALLSTACK("CItemStone::r_GetRef"); if ( !strnicmp("member.", pszKey, 7) ) { pszKey = pszKey + 7; if ( !pszKey[0] ) return false; int nNumber = Exp_GetVal(pszKey); SKIP_SEPARATORS(pszKey); CStoneMember * pMember = STATIC_CAST <CStoneMember *>(GetHead()); for ( int i = 0; pMember != NULL; pMember = pMember->GetNext() ) { if ( !pMember->GetLinkUID().IsChar() ) continue; if ( nNumber == i ) { pRef = pMember; return true; } i++; } } else if ( !strnicmp("memberfromuid.", pszKey, 14) ) { pszKey = pszKey + 14; if ( !pszKey[0] ) return false; CGrayUID pMemberUid = static_cast<DWORD>(Exp_GetVal(pszKey)); SKIP_SEPARATORS(pszKey); CChar * pMemberChar = pMemberUid.CharFind(); if ( pMemberChar ) { CStoneMember * pMemberGuild = GetMember( pMemberChar ); if ( pMemberGuild ) { pRef = pMemberGuild; return true; } } } else if ( !strnicmp("guild.", pszKey, 6) ) { pszKey = pszKey + 6; if ( !pszKey[0] ) return false; int nNumber = Exp_GetVal(pszKey); SKIP_SEPARATORS(pszKey); CStoneMember * pMember = STATIC_CAST <CStoneMember *>(GetHead()); for ( int i = 0; pMember != NULL; pMember = pMember->GetNext() ) { if ( pMember->GetLinkUID().IsChar() ) continue; if ( nNumber == i ) { pRef = pMember; return true; } i++; } } else if ( !strnicmp("guildfromuid.", pszKey, 13) ) { pszKey = pszKey + 13; if ( !pszKey[0] ) return false; CGrayUID pGuildUid = static_cast<DWORD>(Exp_GetVal(pszKey)); SKIP_SEPARATORS(pszKey); CItem * pMemberGuild = pGuildUid.ItemFind(); if ( pMemberGuild ) { CStoneMember * pGuild = GetMember( pMemberGuild ); if ( pGuild ) { pRef = pGuild; return true; } } } return CItem::r_GetRef( pszKey, pRef );}
开发者ID:WangXYZ,项目名称:SphereServer_Source,代码行数:96,
示例4: StrToInt//---------------------------------------------------------------------------void __fastcall TChangeSPWForm::cxButton1Click(TObject *Sender){ String Oldpwstr = TEOldPassword->Text; String Newpwstr1 = TENewPassword1->Text; String Newpwstr2 = TENewPassword2->Text; if("" != Oldpwstr) { if(("" != Newpwstr1)&&("" != Newpwstr2)) { if(Newpwstr1 == Newpwstr2) { ADOQuery1->Close(); ADOQuery1->SQL->Clear(); ADOQuery1->SQL->Add("Select * from XTSET"); ADOQuery1->Open(); // String tmpstr = ADOQuery1->FieldByName("CARDMM")->AsString; //ShowMessage(tmpstr); unsigned int cmplen = 12; if(!strnicmp(DECSuperPassword, Oldpwstr.t_str(), 12))//tmpstr == Oldpwstr) { if(Newpwstr1 == Newpwstr2) { if(12 == Newpwstr1.Length()) { char CDPW[8]; char Enchar[9]; ZeroMemory(CDPW, 8); ZeroMemory(Enchar, 9); String tmppwstr = Newpwstr1; for(int i = 0; i < 6; i++) { int tmpint = StrToInt("0x"+tmppwstr.SubString(i*2+1, 2)); IntToUChar(tmpint, &CDPW[i]); } EncrptyCardMMProc(0, CDPW, Enchar); memcpy(SuperPasword, CDPW, 6); memcpy(DECSuperPassword, tmppwstr.t_str(), 12); char Inbasechar[16]; ZeroMemory(Inbasechar, 16); for(int t = 0; t<8; t++) { char tmp; tmp = Enchar[t]>>4; tmp = tmp&0x0f; // itoa(tmp, &Inbasechar[t*2], 16); if(tmp >= 10) Inbasechar[t*2] = tmp+55; if(tmp <10) Inbasechar[t*2] = tmp+48; tmp = Enchar[t]&0x0f; // itoa(tmp, &Inbasechar[t*2+1], 16); if(tmp >= 10) Inbasechar[t*2+1] = tmp+55; if(tmp <10) Inbasechar[t*2+1] = tmp+48; } String stortstr = Inbasechar; ADOQuery1->Edit(); ADOQuery1->FieldByName("SuperPW")->AsAnsiString = Inbasechar; ADOQuery1->Post(); /* String tmpCARDPassword = ADOQuery1->FieldByName("CARDMM")->AsAnsiString; for(int i = 0; i<6; i++) { int tmpint = StrToInt("0x"+tmpCARDPassword.SubString(i*2+1, 2)); IntToUChar(tmpint, &CARDPassword[i]); } */ MessageBox(this->Handle, " C++ strnlen函数代码示例 C++ strnfmt函数代码示例
|