这篇教程C++ tolower函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中tolower函数的典型用法代码示例。如果您正苦于以下问题:C++ tolower函数的具体用法?C++ tolower怎么用?C++ tolower使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了tolower函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: read_datastatic void read_data (FILE *fp)/* ------------------------------------------------------------------------- * * Read in data files. If NZ > 1, it is assumed that data are in the file * in plane-by-plane order. For each plane, the ordering of data varies * depending on whether the file is in ASCII or binary format: for ASCII, the * fields are in column order, element-by-element (row-major), whereas for * binary formats the fields are written in the file sequentially. * * Automatic conversion between little- and big-endian binary formats. * ------------------------------------------------------------------------- */{ int i, m, n, nplane; int nr_chk, ns_chk, nz_chk, nel_chk; char buf[STR_MAX], *c; /* -- Read the header down to the field list, check size of input. */ for (n = 0; n < 3; n++) fgets(buf, STR_MAX, fp); if (sscanf (buf, "%d%d%d%d", &nr_chk, &ns_chk, &nz_chk, &nel_chk) != 4) { fputs ("error while reading mesh/n", stderr); exit (EXIT_FAILURE); } if (nr != nr_chk || ns != ns_chk || nel != nel_chk) { fputs ("2D structure of mesh and field file do not agree/n", stderr); exit (EXIT_FAILURE); } for (n = 3; n < 9; n++) fgets(buf, STR_MAX, fp); /* -- Read the list of fields. */ n = 0; c = buf; nfields = 0; while (n++ < 25 && nfields < MAXFIELDS) if (isalnum(*c++)) type[nfields++] = *(c-1); if (nfields > MAXFIELDS) { fprintf(stderr, "sem2tec: a maximum of %d fields may be converted./n", MAXFIELDS); exit(EXIT_FAILURE); } /* -- Allocate memory. */ nplane = nr * ns * nel; for (n = 0; n < nfields; n++) data[n] = (double*) malloc (nzp * nplane * sizeof (double)); /* -- Check the format. */ c = fgets(buf, STR_MAX, fp); while (isspace(*c)) c++; switch (tolower(*c)) { /* ASCII or binary read? */ case 'a': for (m = 0; m < nz; m++) for (i = 0; i < nplane; i++) for (n = 0; n < nfields; n++) if (fscanf(fp, "%lf", data[n] + m * nplane + i) < 0) { fputs("sem2tec: field file (ASCII) read error/n", stderr); exit (EXIT_FAILURE); } break; case 'b': { int swab, machine = iformat(); swab = (strstr (buf, "little") && machine == 0 || strstr (buf, "big" ) && machine == 1 ) ? 1 : 0; for (n = 0; n < nfields; n++) { if (fread (data[n], sizeof(double), nz * nplane, fp) != nz * nplane) { fputs("sem2tec: field file (binary) read error/n", stderr); exit (EXIT_FAILURE); } if (swab) dbrev (nz * nplane, data[n], 1, data[n], 1); } break; } default: fprintf (stderr, "sem2tec: unknown format flag: '%c'/n", *c); exit (EXIT_FAILURE); break; }}
开发者ID:jueqingsizhe66,项目名称:MrWang,代码行数:90,
示例2: whilevoid ObjectMgr::LoadExtraCreatureProtoStuff(){ { StorageContainerIterator<CreatureProto> * itr = CreatureProtoStorage.MakeIterator(); CreatureProto* cn; while(!itr->AtEnd()) { cn = itr->Get(); // Process spell fields for( uint32 i = 0; i < MAX_CREATURE_PROTO_SPELLS; i++ ){ if( cn->AISpells[ i ] == 0 ) continue; SpellEntry *sp = dbcSpell.LookupEntryForced( cn->AISpells[ i ] ); if( sp == NULL ) continue; if( ( sp->Attributes & ATTRIBUTES_PASSIVE ) == 0 ) cn->castable_spells.push_back( sp->Id ); else cn->start_auras.insert( sp->Id ); } // process creature spells from creaturespelldata.dbc if( cn->spelldataid != 0 ){ CreatureSpellDataEntry* spe = dbcCreatureSpellData.LookupEntry( cn->spelldataid ); for( uint32 i = 0; i < 3; i++ ){ if( spe->Spells[ i ] == 0 ) continue; SpellEntry *sp = dbcSpell.LookupEntryForced( spe->Spells[ i ] ); if( sp == NULL ) continue; if( ( sp->Attributes & ATTRIBUTES_PASSIVE ) == 0 ) cn->castable_spells.push_back( sp->Id ); else cn->start_auras.insert( sp->Id ); } } if(cn->aura_string) { string auras = string(cn->aura_string); vector<string> aurs = StrSplit(auras, " "); for(vector<string>::iterator it = aurs.begin(); it != aurs.end(); ++it) { uint32 id = atol((*it).c_str()); if(id) cn->start_auras.insert(id); } } if(!cn->MinHealth) cn->MinHealth = 1; if(!cn->MaxHealth) cn->MaxHealth = 1; if(cn->AttackType > SCHOOL_ARCANE) cn->AttackType = SCHOOL_NORMAL; cn->m_canFlee = cn->m_canRangedAttack = cn->m_canCallForHelp = false; cn->m_fleeHealth = 0.0f; // please.... m_fleeDuration is a uint32... //cn->m_fleeDuration = 0.0f; cn->m_fleeDuration = 0; if(!itr->Inc()) break; } itr->Destruct(); } { StorageContainerIterator<CreatureInfo> * itr = CreatureNameStorage.MakeIterator(); CreatureInfo* ci; while(!itr->AtEnd()) { ci = itr->Get(); ci->lowercase_name = string(ci->Name); for(uint32 j = 0; j < ci->lowercase_name.length(); ++j) ci->lowercase_name[j] = static_cast<char>(tolower(ci->lowercase_name[j])); // Darvaleo 2008/08/15 - Copied lowercase conversion logic from ItemPrototype task for(int i = 0; i < NUM_MONSTER_SAY_EVENTS; i++) ci->MonsterSay[i] = objmgr.HasMonsterSay(ci->Id, MONSTER_SAY_EVENTS(i)); if(!itr->Inc()) break; } itr->Destruct(); } // Load AI Agents if(Config.MainConfig.GetBoolDefault("Server", "LoadAIAgents", true)) { QueryResult* result = WorldDatabase.Query("SELECT * FROM ai_agents"); CreatureProto* cn;//.........这里部分代码省略.........
开发者ID:Erotix8210,项目名称:FrozenCore,代码行数:101,
示例3: conntrack_parsestatic int conntrack_parse(int c, char **argv, int invert, unsigned int *flags, const void *entry, struct xt_entry_match **match){ struct xt_conntrack_info *sinfo = (void *)(*match)->data; char *protocol = NULL; unsigned int naddrs = 0; struct in_addr *addrs = NULL; switch (c) { case '1': xtables_check_inverse(optarg, &invert, &optind, 0); parse_states(argv[optind-1], sinfo); if (invert) { sinfo->invflags |= XT_CONNTRACK_STATE; } sinfo->flags |= XT_CONNTRACK_STATE; break; case '2': xtables_check_inverse(optarg, &invert, &optind, 0); if(invert) sinfo->invflags |= XT_CONNTRACK_PROTO; /* Canonicalize into lower case */ for (protocol = argv[optind-1]; *protocol; protocol++) *protocol = tolower(*protocol); protocol = argv[optind-1]; sinfo->tuple[IP_CT_DIR_ORIGINAL].dst.protonum = xtables_parse_protocol(protocol); if (sinfo->tuple[IP_CT_DIR_ORIGINAL].dst.protonum == 0 && (sinfo->invflags & XT_INV_PROTO)) xtables_error(PARAMETER_PROBLEM, "rule would never match protocol"); sinfo->flags |= XT_CONNTRACK_PROTO; break; case '3': xtables_check_inverse(optarg, &invert, &optind, 0); if (invert) sinfo->invflags |= XT_CONNTRACK_ORIGSRC; xtables_ipparse_any(argv[optind-1], &addrs, &sinfo->sipmsk[IP_CT_DIR_ORIGINAL], &naddrs); if(naddrs > 1) xtables_error(PARAMETER_PROBLEM, "multiple IP addresses not allowed"); if(naddrs == 1) { sinfo->tuple[IP_CT_DIR_ORIGINAL].src.ip = addrs[0].s_addr; } sinfo->flags |= XT_CONNTRACK_ORIGSRC; break; case '4': xtables_check_inverse(optarg, &invert, &optind, 0); if (invert) sinfo->invflags |= XT_CONNTRACK_ORIGDST; xtables_ipparse_any(argv[optind-1], &addrs, &sinfo->dipmsk[IP_CT_DIR_ORIGINAL], &naddrs); if(naddrs > 1) xtables_error(PARAMETER_PROBLEM, "multiple IP addresses not allowed"); if(naddrs == 1) { sinfo->tuple[IP_CT_DIR_ORIGINAL].dst.ip = addrs[0].s_addr; } sinfo->flags |= XT_CONNTRACK_ORIGDST; break; case '5': xtables_check_inverse(optarg, &invert, &optind, 0); if (invert) sinfo->invflags |= XT_CONNTRACK_REPLSRC; xtables_ipparse_any(argv[optind-1], &addrs, &sinfo->sipmsk[IP_CT_DIR_REPLY], &naddrs); if(naddrs > 1) xtables_error(PARAMETER_PROBLEM, "multiple IP addresses not allowed"); if(naddrs == 1) { sinfo->tuple[IP_CT_DIR_REPLY].src.ip = addrs[0].s_addr; } sinfo->flags |= XT_CONNTRACK_REPLSRC;//.........这里部分代码省略.........
开发者ID:OpenInkpot-archive,项目名称:iplinux-iptables,代码行数:101,
示例4: get_codec_namestd::string get_codec_name(AVCodecContext *pCodecCtx){ AVCodecID id = pCodecCtx->codec_id; // Grab the codec const AVCodec *p = avcodec_find_decoder(id); const AVCodecDescriptor *desc = avcodec_descriptor_get(id); const char *profile = avcodec_profile_name(id, pCodecCtx->profile); std::ostringstream codec_name; const char *nice_name = nullptr; for (int i = 0; i < countof(nice_codec_names); ++i) { if (nice_codec_names[i].id == id) { nice_name = nice_codec_names[i].name; break; } } if (id == AV_CODEC_ID_DTS && pCodecCtx->codec_tag == 0xA2) { profile = "DTS Express"; } if (id == AV_CODEC_ID_H264 && profile) { codec_name << nice_name << " " << tolower(profile); if (pCodecCtx->level && pCodecCtx->level != FF_LEVEL_UNKNOWN && pCodecCtx->level < 1000) { char l_buf[5]; sprintf_s(l_buf, "%.1f", pCodecCtx->level / 10.0); codec_name << " L" << l_buf; } } else if (id == AV_CODEC_ID_VC1 && profile) { codec_name << nice_name << " " << tolower(profile); if (pCodecCtx->level != FF_LEVEL_UNKNOWN) { codec_name << " L" << pCodecCtx->level; } } else if (id == AV_CODEC_ID_DTS && profile) { codec_name << tolower(profile); } else if (id == AV_CODEC_ID_JPEG2000 && profile) { codec_name << tolower(profile); } else if (nice_name) { codec_name << nice_name; if (profile) codec_name << " " << tolower(profile); } else if (desc && desc->name) { codec_name << desc->name; if (profile) codec_name << " " << tolower(profile); } else if (p && p->name) { codec_name << p->name; if (profile) codec_name << " " << tolower(profile); } else { /* output avi tags */ char buf[32]; av_get_codec_tag_string(buf, sizeof(buf), pCodecCtx->codec_tag); codec_name << buf; sprintf_s(buf, "0x%04X", pCodecCtx->codec_tag); codec_name << " / " << buf; } return codec_name.str();}
开发者ID:yanxu4780,项目名称:LAVFilters,代码行数:62,
示例5: mainVOID__cdeclmain( _In_ int argc, _In_z_ char *argv[] ){ BOOL status = 0; DWORD accessMode = 0, shareMode = 0; HANDLE fileHandle = NULL; ULONG alignmentMask = 0; // default == no alignment requirement UCHAR srbType = 0; // default == SRB_TYPE_SCSI_REQUEST_BLOCK PUCHAR dataBuffer = NULL; PUCHAR pUnAlignedBuffer = NULL; SCSI_PASS_THROUGH_WITH_BUFFERS sptwb; SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER sptdwb; SCSI_PASS_THROUGH_WITH_BUFFERS_EX sptwb_ex; SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER_EX sptdwb_ex; CHAR string[NAME_COUNT]; ULONG length = 0, errorCode = 0, returned = 0, sectorSize = 512; if ((argc < 2) || (argc > 3)) { printf("Usage: %s <port-name> [-mode]/n", argv[0] ); printf("Examples:/n"); printf(" spti g: (open the disk class driver in SHARED READ/WRITE mode)/n"); printf(" spti Scsi2: (open the miniport driver for the 3rd host adapter)/n"); printf(" spti Tape0 w (open the tape class driver in SHARED WRITE mode)/n"); printf(" spti i: c (open the CD-ROM class driver in SHARED READ mode)/n"); return; } StringCbPrintf(string, sizeof(string), "////.//%s", argv[1]); shareMode = FILE_SHARE_READ | FILE_SHARE_WRITE; // default accessMode = GENERIC_WRITE | GENERIC_READ; // default if (argc == 3) { switch(tolower(argv[2][0])) { case 'r': shareMode = FILE_SHARE_READ; break; case 'w': shareMode = FILE_SHARE_WRITE; break; case 'c': shareMode = FILE_SHARE_READ; sectorSize = 2048; break; default: printf("%s is an invalid mode./n", argv[2]); puts("/tr = read"); puts("/tw = write"); puts("/tc = read CD (2048 byte sector mode)"); return; } } fileHandle = CreateFile(string, accessMode, shareMode, NULL, OPEN_EXISTING, 0, NULL); if (fileHandle == INVALID_HANDLE_VALUE) { errorCode = GetLastError(); printf("Error opening %s. Error: %d/n", string, errorCode); PrintError(errorCode); return; } // // Get the alignment requirements // status = QueryPropertyForDevice(fileHandle, &alignmentMask, &srbType); if (!status ) { errorCode = GetLastError(); printf("Error getting device and/or adapter properties; " "error was %d/n", errorCode); PrintError(errorCode); CloseHandle(fileHandle); return; } printf("/n" " ***** Detected Alignment Mask *****/n" " ***** was %08x *****/n/n/n", alignmentMask);//.........这里部分代码省略.........
开发者ID:0xhack,项目名称:Windows-driver-samples,代码行数:101,
示例6: main//.........这里部分代码省略......... info("Product Version: %s/n", client->version); info("Product Build: %s/n", client->build); if (client->flags & FLAG_CUSTOM) { /* prevent signing custom firmware */ tss_enabled = 0; info("Custom firmware requested. Disabled TSS request./n"); } // choose whether this is an upgrade or a restore (default to upgrade) client->tss = NULL; plist_t build_identity = NULL; if (client->flags & FLAG_CUSTOM) { build_identity = plist_new_dict(); { plist_t node; plist_t comp; plist_t info; plist_t manifest; info = plist_new_dict(); plist_dict_insert_item(info, "RestoreBehavior", plist_new_string((client->flags & FLAG_ERASE) ? "Erase" : "Update")); plist_dict_insert_item(info, "Variant", plist_new_string((client->flags & FLAG_ERASE) ? "Customer Erase Install (IPSW)" : "Customer Upgrade Install (IPSW)")); plist_dict_insert_item(build_identity, "Info", info); manifest = plist_new_dict(); char tmpstr[256]; char p_all_flash[128]; char lcmodel[8]; strcpy(lcmodel, client->device->model); int x = 0; while (lcmodel[x]) { lcmodel[x] = tolower(lcmodel[x]); x++; } sprintf(p_all_flash, "Firmware/all_flash/all_flash.%s.%s", lcmodel, "production"); strcpy(tmpstr, p_all_flash); strcat(tmpstr, "/manifest"); // get all_flash file manifest char *files[16]; char *fmanifest = NULL; uint32_t msize = 0; if (ipsw_extract_to_memory(ipsw, tmpstr, &fmanifest, &msize) < 0) { error("ERROR: could not extract %s from IPSW/n", tmpstr); return -1; } char *tok = strtok(fmanifest, "/r/n"); int fc = 0; while (tok) { files[fc++] = strdup(tok); if (fc >= 16) { break; } tok = strtok(NULL, "/r/n"); } free(fmanifest); for (x = 0; x < fc; x++) { info = plist_new_dict(); strcpy(tmpstr, p_all_flash); strcat(tmpstr, "/"); strcat(tmpstr, files[x]);
开发者ID:Cunzhang,项目名称:idevicerestore,代码行数:67,
示例7: gravacao/*start function*/int gravacao (){ system("title grava e le arquivo"); FILE *p; char nome[20],tele[10], opcao; p = fopen("dados.001","rt"); if (p==NULL){ printf("/n ....:Programa Dados Alunos:...../n/n"); printf("/n arquivo nao existe...novo criado/n"); p= fopen("dados.001","wt"); if (p == NULL) return (-1); }else{ printf("/t ....:Programa Dados Alunos:...../n/n"); printf("/nlogado/n"); fclose(p); p = fopen("dados.001", "at"); } while (1){ printf("/n<C A D A S T R O>/n/n/n/n"); printf("/nNome :"); scanf("%s", nome); printf("/nTelefone :"); scanf("%s", tele); printf("/nconfirma gravar este registro? [s/n]:"); do{ opcao = getchar(); }while (tolower(opcao) != 's' && tolower(opcao) != 'n'); if (tolower(opcao) == ' '){ fprintf(p, "%s %s/n", nome, tele); printf("/n registro gravado"); } else{printf("/n registro nao gravado"); } printf("/ndeseja continuar gravando este registro? [s/n]:"); do{ opcao = getchar(); }while (tolower(opcao) != 's' && tolower(opcao) != 'n'); if (tolower(opcao) == 'n'){ printf("fim da gravacao"); break;} } fprintf(p,"%s %s /n",nome, tele); fclose(p); main(); }
开发者ID:eliocapelati,项目名称:Academic-Projects,代码行数:63,
示例8: strlowerchar* strlower(char * str) {//changes string in place if (str==NULL) return NULL; int i=0; while (str[i]!=0) { str[i]=tolower(str[i]); i++; } return str;}
开发者ID:BenLangmead,项目名称:stringtie,代码行数:6,
示例9: startsiWithbool startsiWith(const char* s, const char* prefix) { if (prefix==NULL || s==NULL) return false; int i=0; while (prefix[i]!='/0' && tolower(prefix[i])==tolower(s[i])) i++; return (prefix[i]=='/0'); }
开发者ID:BenLangmead,项目名称:stringtie,代码行数:6,
示例10: oscl_tolowerOSCL_EXPORT_REF char oscl_tolower(const char car){ return tolower(car);}
开发者ID:acassis,项目名称:emlinux-ssd1935,代码行数:4,
示例11: memsetvoid *processline(char *s) { char name[80],value[80]; int nvstate = 0; memset (name,0,sizeof name); memset (value,0,sizeof value); do { *s = tolower(*s); if ( *s == ' ' || *s == '/t') continue; if ( *s == ';' || *s == '#' || *s == '/r' || *s == '/n' ) break; if ( *s == '=' ) { nvstate = 1; continue; } if (!nvstate) strncat(name, s, 1); else strncat(value, s, 1); } while (*(s++)); if (debug) debugmsg("config: %s, %s", name, value); if ( !strcmp(name,"host") ) add_server(value); else if (!strcmp(name,"retryinterval") ) pc.retryinterval = atoi(value); else if (!strcmp(name,"maxretries") ) pc.maxretries = atoi(value); else if (!strcmp(name,"listenaddress") ) strcpy(pc.listen_addr, value); else if (!strcmp(name,"listenport") ) pc.listen_port = atoi(value); else if (!strcmp(name,"asteriskwritetimeout") ) pc.asteriskwritetimeout = atoi(value); else if (!strcmp(name,"clientwritetimeout") ) pc.clientwritetimeout = atoi(value); else if (!strcmp(name,"sslclienthellotimeout") ) pc.sslclhellotimeout = atoi(value); else if (!strcmp(name,"authrequired") ) pc.authrequired = strcmp(value,"yes") ? 0 : 1; else if (!strcmp(name,"acceptencryptedconnection") ) pc.acceptencryptedconnection = strcmp(value,"yes") ? 0 : 1; else if (!strcmp(name,"acceptunencryptedconnection") ) pc.acceptunencryptedconnection = strcmp(value,"yes") ? 0 : 1; else if (!strcmp(name,"certfile") ) strcpy(pc.certfile, value); else if (!strcmp(name,"proxykey") ) strcpy(pc.key, value); else if (!strcmp(name,"proc_user") ) strcpy(pc.proc_user, value); else if (!strcmp(name,"proc_group") ) strcpy(pc.proc_group, value); else if (!strcmp(name,"logfile") ) strcpy(pc.logfile, value); else if (!strcmp(name,"autofilter") ) pc.autofilter = strcmp(value,"on") ? 0 : 1; else if (!strcmp(name,"outputformat") ) strcpy(pc.outputformat, value); else if (!strcmp(name,"inputformat") ) strcpy(pc.inputformat, value); return 0;}
开发者ID:3lsilver,项目名称:astmanproxy,代码行数:69,
示例12: open_config_file//Format://caid:prov:srvid:pid:chid:ecmlen=caid:prov:srvid:pid:chid:ecmlen[,validfrom,validto]//validfrom: default=-2000//validto: default=4000//valid time if found in cachestatic struct s_cacheex_matcher *cacheex_matcher_read_int(void){ FILE *fp = open_config_file(cs_cacheex_matcher); if(!fp) { return NULL; } char token[1024]; uint8_t type; int32_t i, ret, count = 0; struct s_cacheex_matcher *new_cacheex_matcher = NULL, *entry, *last = NULL; uint32_t line = 0; while(fgets(token, sizeof(token), fp)) { line++; if(strlen(token) <= 1) { continue; } if(token[0] == '#' || token[0] == '/') { continue; } if(strlen(token) > 100) { continue; } for(i = 0; i < (int)strlen(token); i++) { if((token[i] == ':' || token[i] == ' ') && token[i + 1] == ':') { memmove(token + i + 2, token + i + 1, strlen(token) - i + 1); token[i + 1] = '0'; } if(token[i] == '#' || token[i] == '/') { token[i] = '/0'; break; } } type = 'm'; uint32_t caid = 0, provid = 0, srvid = 0, pid = 0, chid = 0, ecmlen = 0; uint32_t to_caid = 0, to_provid = 0, to_srvid = 0, to_pid = 0, to_chid = 0, to_ecmlen = 0; int32_t valid_from = -2000, valid_to = 4000; ret = sscanf(token, "%c:%4x:%6x:%4x:%4x:%4x:%4X=%4x:%6x:%4x:%4x:%4x:%4X,%4d,%4d", &type, &caid, &provid, &srvid, &pid, &chid, &ecmlen, &to_caid, &to_provid, &to_srvid, &to_pid, &to_chid, &to_ecmlen, &valid_from, &valid_to); type = tolower(type); if(ret < 7 || type != 'm') { continue; } if(!cs_malloc(&entry, sizeof(struct s_cacheex_matcher))) { fclose(fp); return new_cacheex_matcher; } count++; entry->line = line; entry->type = type; entry->caid = caid; entry->provid = provid; entry->srvid = srvid; entry->pid = pid; entry->chid = chid; entry->ecmlen = ecmlen; entry->to_caid = to_caid; entry->to_provid = to_provid; entry->to_srvid = to_srvid; entry->to_pid = to_pid; entry->to_chid = to_chid; entry->to_ecmlen = to_ecmlen; entry->valid_from = valid_from; entry->valid_to = valid_to; cs_log_dbg(D_TRACE, "cacheex-matcher: %c: %[email C++ tolstream函数代码示例 C++ tokenizer函数代码示例
|