这篇教程C++ stok函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中stok函数的典型用法代码示例。如果您正苦于以下问题:C++ stok函数的具体用法?C++ stok怎么用?C++ stok使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了stok函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: mprNormalizePath/* Search for a module "filename" in the modulePath. Return the result in "result" */PUBLIC char *mprSearchForModule(cchar *filename){#if ME_COMPILER_HAS_DYN_LOAD char *path, *f, *searchPath, *dir, *tok; filename = mprNormalizePath(filename); /* Search for the path directly */ if ((path = probe(filename)) != 0) { return path; } /* Search in the searchPath */ searchPath = sclone(mprGetModuleSearchPath()); tok = 0; dir = stok(searchPath, MPR_SEARCH_SEP, &tok); while (dir && *dir) { f = mprJoinPath(dir, filename); if ((path = probe(f)) != 0) { return path; } dir = stok(0, MPR_SEARCH_SEP, &tok); }#endif /* ME_COMPILER_HAS_DYN_LOAD */ return 0;}
开发者ID:embedthis,项目名称:mpr,代码行数:33,
示例2: httpParsePlatformPUBLIC int httpParsePlatform(cchar *platform, cchar **osp, cchar **archp, cchar **profilep){ char *arch, *os, *profile, *rest; if (osp) { *osp = 0; } if (archp) { *archp = 0; } if (profilep) { *profilep = 0; } if (platform == 0 || *platform == '/0') { return MPR_ERR_BAD_ARGS; } os = stok(sclone(platform), "-", &rest); arch = sclone(stok(NULL, "-", &rest)); profile = sclone(rest); if (os == 0 || arch == 0 || profile == 0 || *os == '/0' || *arch == '/0' || *profile == '/0') { return MPR_ERR_BAD_ARGS; } if (osp) { *osp = os; } if (archp) { *archp = arch; } if (profilep) { *profilep = profile; } return 0;}
开发者ID:DavidQuan,项目名称:http,代码行数:33,
示例3: mprNormalizePath/* Search for a module "filename" in the modulePath. Return the result in "result" */char *mprSearchForModule(cchar *filename){#if BIT_HAS_DYN_LOAD char *path, *f, *searchPath, *dir, *tok; filename = mprNormalizePath(filename); /* Search for the path directly */ if ((path = probe(filename)) != 0) { mprLog(6, "Found native module %s at %s", filename, path); return path; } /* Search in the searchPath */ searchPath = sclone(mprGetModuleSearchPath()); tok = 0; dir = stok(searchPath, MPR_SEARCH_SEP, &tok); while (dir && *dir) { f = mprJoinPath(dir, filename); if ((path = probe(f)) != 0) { mprLog(6, "Found native module %s at %s", filename, path); return path; } dir = stok(0, MPR_SEARCH_SEP, &tok); }#endif /* BIT_HAS_DYN_LOAD */ return 0;}
开发者ID:ni-webtech,项目名称:mpr-4,代码行数:35,
示例4: computeUserAbilitiesstatic void computeUserAbilities(WebsUser *user){ char *ability, *roles, *tok; assure(user); if ((user->abilities = hashCreate(-1)) == 0) { return; } roles = sclone(user->roles); for (ability = stok(roles, " /t,", &tok); ability; ability = stok(NULL, " /t,", &tok)) { computeAbilities(user->abilities, ability, 0); }#if BIT_DEBUG { WebsKey *key; trace(5, "User /"%s/" has abilities: ", user->name); for (key = hashFirst(user->abilities); key; key = hashNext(user->abilities, key)) { trace(5, "%s ", key->name.value.string); ability = key->name.value.string; } trace(5, "/n"); }#endif wfree(roles);}
开发者ID:kamihouse,项目名称:goahead,代码行数:25,
示例5: mainint main(){ setlocale(LC_ALL, "Russian"); char StringEntered[] = "192.168.10.2:home/OpenMPI/MPicc.exe"; char *Links[10]; // Массив указателей на подстроки из String; char *IPLinks[4]; // Массив указателей на подстроки IP-адреса; char DelimeterPath = ':'; // Разделитель для пути; char DelimeterIP = '.'; // Разделитель для IP; int QuantityOfSubStrings; int QuantityOfIPSubStrings; int SCPCorrect; int IPCorrect; int index; QuantityOfSubStrings = stok(StringEntered, DelimeterPath, Links); QuantityOfSubStrings = stok(Links[0], DelimeterIP, IPLinks); IPCorrect = IPChecking(IPLinks); printf("Количество подстрок: %d", QuantityOfSubStrings); printf("Количество подстрок IP: %d", QuantityOfIPSubStrings); SCPCorrect = SCPChecking(IPLinks[0]); if(SCPCorrect == 1) printf("Протокол SCP некорректен"); if(IPCorrect == -1) printf("IP неверен/n"); return 0;}
开发者ID:ArsenyLisenko9651,项目名称:PROGRAM,代码行数:29,
示例6: httpSetAuthRequiredAbilities/* Can supply a roles or abilities in the "abilities" parameter */PUBLIC void httpSetAuthRequiredAbilities(HttpAuth *auth, cchar *abilities){ char *ability, *tok; GRADUATE_HASH(auth, abilities); for (ability = stok(sclone(abilities), " /t,", &tok); abilities; abilities = stok(NULL, " /t,", &tok)) { httpComputeRoleAbilities(auth, auth->abilities, ability); }}
开发者ID:wangeshen,项目名称:http,代码行数:12,
示例7: addFormVarsstatic void addFormVars(cchar *buf){ char *pair, *tok; pair = stok(sclone(buf), "&", &tok); while (pair != 0) { mprAddItem(app->formData, sclone(pair)); pair = stok(0, "&", &tok); }}
开发者ID:varphone,项目名称:ejs-2,代码行数:10,
示例8: parseQuerystatic void parseQuery(HttpConn *conn){ HttpRx *rx; HttpDir *dir; char *value, *query, *next, *tok, *field; rx = conn->rx; dir = conn->reqData; query = sclone(rx->parsedUri->query); if (query == 0) { return; } tok = stok(query, ";&", &next); while (tok) { if ((value = strchr(tok, '=')) != 0) { *value++ = '/0'; if (*tok == 'C') { /* Sort column */ field = 0; if (*value == 'N') { field = "Name"; } else if (*value == 'M') { field = "Date"; } else if (*value == 'S') { field = "Size"; } if (field) { dir->sortField = sclone(field); } } else if (*tok == 'O') { /* Sort order */ if (*value == 'A') { dir->sortOrder = 1; } else if (*value == 'D') { dir->sortOrder = -1; } } else if (*tok == 'F') { /* Format */ if (*value == '0') { dir->fancyIndexing = 0; } else if (*value == '1') { dir->fancyIndexing = 1; } else if (*value == '2') { dir->fancyIndexing = 2; } } else if (*tok == 'P') { /* Pattern */ dir->pattern = sclone(value); } } tok = stok(next, ";&", &next); }}
开发者ID:DavidQuan,项目名称:http,代码行数:53,
示例9: parseDigestNoncestatic int parseDigestNonce(char *nonce, cchar **secret, cchar **realm, MprTime *when){ char *tok, *decoded, *whenStr; if ((decoded = mprDecode64(nonce)) == 0) { return MPR_ERR_CANT_READ; } *secret = stok(decoded, ":", &tok); *realm = stok(NULL, ":", &tok); whenStr = stok(NULL, ":", &tok); *when = (MprTime) stoiradix(whenStr, 16, NULL); return 0;}
开发者ID:adammendoza,项目名称:http,代码行数:13,
示例10: httpSetAuthPermittedUsers/* Can also achieve this via abilities */PUBLIC void httpSetAuthPermittedUsers(HttpAuth *auth, cchar *users){ char *user, *tok; GRADUATE_HASH(auth, permittedUsers); for (user = stok(sclone(users), " /t,", &tok); users; users = stok(NULL, " /t,", &tok)) { if (smatch(user, "*")) { auth->permittedUsers = 0; break; } else { mprAddKey(auth->permittedUsers, user, user); } }}
开发者ID:wangeshen,项目名称:http,代码行数:17,
示例11: optionsDirective/* Options Indexes */static int optionsDirective(MaState *state, cchar *key, cchar *value){ Dir *dir; char *option, *tok; dir = getDirObj(state); option = stok(sclone(value), " /t", &tok); while (option) { if (scaselessmatch(option, "Indexes")) { dir->enabled = 1; } option = stok(tok, " /t", &tok); } return 0;}
开发者ID:yodamaster,项目名称:appweb,代码行数:18,
示例12: info/* function get info(): Object */static EjsObj *http_info(Ejs *ejs, EjsHttp *hp, int argc, EjsObj **argv){ EjsObj *obj; char *key, *next, *value; if (hp->conn && hp->conn->sock) { obj = ejsCreateEmptyPot(ejs); for (key = stok(mprGetSocketState(hp->conn->sock), ",", &next); key; key = stok(NULL, ",", &next)) { stok(key, "=", &value); ejsSetPropertyByName(ejs, obj, EN(key), ejsCreateStringFromAsc(ejs, value)); } return obj; } return ESV(null);}
开发者ID:soffmodd,项目名称:ejs-2,代码行数:18,
示例13: bufCreate/* Map iana names to OpenSSL names so users can provide IANA names as well as OpenSSL cipher names */static char *mapCipherNames(char *ciphers){ WebsBuf buf; CipherMap *cp; char *cipher, *next, *str; if (!ciphers || *ciphers == 0) { return 0; } bufCreate(&buf, 0, 0); ciphers = sclone(ciphers); for (next = ciphers; (cipher = stok(next, ":, /t", &next)) != 0; ) { for (cp = cipherMap; cp->name; cp++) { if (smatch(cp->name, cipher)) { bufPut(&buf, "%s:", cp->ossName); break; } } if (cp->name == 0) { bufPut(&buf, "%s:", cipher); } } wfree(ciphers); str = sclone(bufStart(&buf)); bufFree(&buf); return str;}
开发者ID:hemangi1,项目名称:goahead,代码行数:30,
示例14: CoreExceptionvoid ViewDescriptor::LoadFromExtension(){ configElement->GetAttribute(WorkbenchRegistryConstants::ATT_ID, id); // Sanity check. std::string name; if ((configElement->GetAttribute(WorkbenchRegistryConstants::ATT_NAME, name) == false) || (RegistryReader::GetClassValue(configElement, WorkbenchRegistryConstants::ATT_CLASS) == "")) { throw CoreException( "Invalid extension (missing label or class name)", id); } std::string category; if (configElement->GetAttribute(WorkbenchRegistryConstants::TAG_CATEGORY, category)) { Poco::StringTokenizer stok(category, "/", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM); // Parse the path tokens and store them for (Poco::StringTokenizer::Iterator iter = stok.begin(); iter != stok.end(); ++iter) { categoryPath.push_back(*iter); } }}
开发者ID:test-fd301,项目名称:MITK,代码行数:25,
示例15: httpWriteUploadData/* Write upload data. This routine blocks. If you need non-blocking ... cut and paste. */ssize httpWriteUploadData(HttpConn *conn, MprList *fileData, MprList *formData){ char *path, *pair, *key, *value, *name; ssize rc; int next; rc = 0; if (formData) { for (rc = next = 0; rc >= 0 && (pair = mprGetNextItem(formData, &next)) != 0; ) { key = stok(sclone(pair), "=", &value); rc += httpWrite(conn->writeq, "%s/r/nContent-Disposition: form-data; name=/"%s/";/r/n", conn->boundary, key); rc += httpWrite(conn->writeq, "Content-Type: application/x-www-form-urlencoded/r/n/r/n%s/r/n", value); } } if (fileData) { for (rc = next = 0; rc >= 0 && (path = mprGetNextItem(fileData, &next)) != 0; ) { name = mprGetPathBase(path); rc += httpWrite(conn->writeq, "%s/r/nContent-Disposition: form-data; name=/"file%d/"; filename=/"%s/"/r/n", conn->boundary, next - 1, name); rc += httpWrite(conn->writeq, "Content-Type: %s/r/n/r/n", mprLookupMime(MPR->mimeTypes, path)); rc += blockingFileCopy(conn, path); rc += httpWrite(conn->writeq, "/r/n"); } } rc += httpWrite(conn->writeq, "%s--/r/n--", conn->boundary); httpFinalize(conn); return rc;}
开发者ID:ni-webtech,项目名称:http,代码行数:31,
示例16: isdomain int isdomain(char *str) { char d_ru[] = "ru"; char d_com[] = "com"; char d_org[] = "org"; char *EL[MAXSIZE]; int i; if (6 > slen(str)) return 0; int Z = stok(str, '.', EL); if (!((scmp(EL[Z - 1], d_ru) == 0) || (scmp(EL[Z - 1], d_com) == 0) || (scmp(EL[Z - 1], d_org) == 0))) { suntok(str, '.', EL, Z); return 0; } suntok(str, '.', EL, Z); if (3 != Z) return 0; for (i = 0; str[i] != '/0'; i++) { if (!((str[i] >= 'A')&&(str[i] <= 'Z') || ( (str[i] >= 'a')&&(str[i] <= 'z')) || str[i] == '.' )) return 0; } return 1; }
开发者ID:DSG888,项目名称:SibSUTIS,代码行数:25,
示例17: mprIsVersionObjAcceptable/* Test if the version is acceptable based on the supplied critera. The acceptable formats for criteria are: VER Allows prereleases 1.2.[*xX] Wild card version portion. (allows prereleases). ~VER Compatible with VER at the least significant level. ~1.2.3 == (>=1.2.3 <1.3.0) Compatible at the patch level ~1.2 == 1.2.x Compatible at the minor level ~1 == 1.x Compatible at the major level ^VER Compatible with VER at the most significant level. ^0.2.3 == 0.2.3 <= VER < 0.3.0 ^1.2.3 == 1.2.3 <= VER < 2.0.0 [>, >=, <, <=, ==, !=]VER Create range relative to given version EXPR1 - EXPR2 <=EXPR1 <=EXPR2 EXPR1 || EXPR2 ... EXPR1 OR EXPR2 EXPR1 && EXPR2 ... EXPR1 AND EXPR2 EXPR1 EXPR2 ... EXPR1 AND EXPR2 Pre-release versions will only match if the criteria contains a "-.*" prerelease suffix*/PUBLIC bool mprIsVersionObjAcceptable(MprVersion *vp, cchar *criteria){ char *expr, *exprTok, *range, *rangeTok, *low, *high; bool allMatched; if (!vp->ok) { return 0; } if (!criteria || *criteria == '/0') { return 1; } criteria = cleanVersion(criteria); for (range = (char*) criteria; stok(range, "||", &rangeTok) != 0; range = rangeTok) { range = strim(range, " /t", 0); allMatched = 1; for (expr = (char*) range; sptok(expr, "&&", &exprTok) != 0; expr = exprTok) { if (scontains(expr, " - ")) { low = sptok(expr, " - ", &high); return inRange(vp, sjoin(">=", low, NULL)) && inRange(vp, sjoin("<=", high, NULL)); } if (!inRange(vp, expr)) { allMatched = 0; break; } } if (allMatched) { return 1; } } return 0;}
开发者ID:DavionKnight,项目名称:RtFileSystem,代码行数:52,
示例18: mainint main(){ int i; char ch[260]; // vremenniy massiv dlya dannih char delim; // razdelitel' printf("Vvedite razdlitel':/n"); scanf("%c", &delim); // razdelitel' printf("Vvedite imya polzovatelya:/n"); scanf("%s", &ch); char *username = (int *)malloc(size_s(ch)*sizeof(int)); // imya polzovatelya for (i=0; i<size_s(ch); i++) username[i]=ch[i]; printf("Vvedite imya domashney direktorii:/n"); scanf("%s", &ch); char *dir = (int *)malloc(size_s(ch)*sizeof(int)); // imya domashnego kataloga for (i=0; i<size_s(ch); i++) dir[i]=ch[i]; printf("Vvedite puti cherez razdeliteli:/n"); scanf("%s", &ch); char *paths = (int *)malloc(size_s(ch)*sizeof(int)); // vhodnaya stroka s putyami for (i=0; i<size_s(ch); i++) paths[i]=ch[i]; //printf("Vvedeno:/n%c/n%s/n%s/n%s/n", delim, username, dir, paths); stok(paths, delim); // zanosim puti v noviy massiv //sspn(paths); return 0;}
开发者ID:PopovMihail,项目名称:program,代码行数:30,
示例19: Researcherint Researcher(char *Str){ int isipv4(char *str) { char *EL[MAXSIZE]; int i, j; if ((7 > slen(str)) || (15 < slen(str))) return 0; int Z = stok(str, '.', EL); if (Z != 4) { suntok(str, '.', EL, Z); return 0; } for (i = 0; i < Z; ++i) { for (j = 0; EL[i][j] != '/0'; ++j) { if (myisdigit(EL[i][j])) continue; else { suntok(str, '.', EL, Z); return 0; } } if (255 < myatoi(EL[i])) { suntok(str, '.', EL, Z); return 0; } } suntok(str, '.', EL, Z); return 1; }
开发者ID:DSG888,项目名称:SibSUTIS,代码行数:35,
示例20: getParams/* Convert queue data in key / value pairs MOB - should be able to remove this and use standard form parsing */static int getParams(char ***keys, char *buf, int len){ char** keyList; char *eq, *cp, *pp, *tok; int i, keyCount; *keys = 0; /* Change all plus signs back to spaces */ keyCount = (len > 0) ? 1 : 0; for (cp = buf; cp < &buf[len]; cp++) { if (*cp == '+') { *cp = ' '; } else if (*cp == '&' && (cp > buf && cp < &buf[len - 1])) { keyCount++; } } if (keyCount == 0) { return 0; } /* Crack the input into name/value pairs */ keyList = mprAlloc((keyCount * 2) * sizeof(char**)); i = 0; tok = 0; for (pp = stok(buf, "&", &tok); pp; pp = stok(0, "&", &tok)) { if ((eq = strchr(pp, '=')) != 0) { *eq++ = '/0'; pp = mprUriDecode(pp); eq = mprUriDecode(eq); } else { pp = mprUriDecode(pp); eq = 0; } if (i < (keyCount * 2)) { keyList[i++] = pp; keyList[i++] = eq; } } *keys = keyList; return keyCount;}
开发者ID:ni-webtech,项目名称:appweb-4,代码行数:50,
示例21: parseDigestNoncestatic int parseDigestNonce(char *nonce, char **secret, char **realm, WebsTime *when){ char *tok, *decoded, *whenStr; assure(nonce && *nonce); assure(secret); assure(realm); assure(when); if ((decoded = websDecode64(nonce)) == 0) { return -1; } *secret = stok(decoded, ":", &tok); *realm = stok(NULL, ":", &tok); whenStr = stok(NULL, ":", &tok); *when = hextoi(whenStr); return 0;}
开发者ID:kamihouse,项目名称:goahead,代码行数:18,
示例22: processvoid process(char *str){ char *ptr[20]; int count; int i; count = stok(str, '/', ptr); suntok(str, '//', ptr, count);}
开发者ID:Direnol,项目名称:Programm,代码行数:9,
示例23: indexOptionsDirective/* IndexOptions FancyIndexing|FoldersFirst ... (set of options) */static int indexOptionsDirective(MaState *state, cchar *key, cchar *value){ Dir *dir; char *option, *tok; dir = getDirObj(state); option = stok(sclone(value), " /t", &tok); while (option) { if (scaselessmatch(option, "FancyIndexing")) { dir->fancyIndexing = 1; } else if (scaselessmatch(option, "HTMLTable")) { dir->fancyIndexing = 2; } else if (scaselessmatch(option, "FoldersFirst")) { dir->foldersFirst = 1; } option = stok(tok, " /t", &tok); } return 0;}
开发者ID:yodamaster,项目名称:appweb,代码行数:22,
示例24: processvoid process(char *path, char *delim){ int count, i; char *subpath[10]; count = stok(path, delim[0], subpath); for (i = 0; i < count; i++) processing(subpath[i]); suntok(path, delim[0], subpath, count); change(path);}
开发者ID:Doshinsky,项目名称:Programming-Lab-3,代码行数:10,
示例25: snclone/* Parse cached content of the form: headers /n/n data Set headers in the current requeset and return a reference to the data portion */static cchar *setHeadersFromCache(HttpConn *conn, cchar *content){ cchar *data; char *header, *headers, *key, *value, *tok; if ((data = strstr(content, "/n/n")) == 0) { data = content; } else { headers = snclone(content, data - content); data += 2; for (header = stok(headers, "/n", &tok); header; header = stok(NULL, "/n", &tok)) { key = stok(header, ": ", &value); if (smatch(key, "X-Status")) { conn->tx->status = (int) stoi(value); } else { httpAddHeader(conn, key, value); } } } return data;}
开发者ID:ni-webtech,项目名称:http,代码行数:25,
示例26: GRADUATE_HASHPUBLIC HttpRole *httpAddRole(HttpAuth *auth, cchar *name, cchar *abilities){ HttpRole *role; char *ability, *tok; GRADUATE_HASH(auth, roles); if ((role = mprLookupKey(auth->roles, name)) == 0) { if ((role = mprAllocObj(HttpRole, manageRole)) == 0) { return 0; } role->name = sclone(name); } role->abilities = mprCreateHash(0, 0); for (ability = stok(sclone(abilities), " /t", &tok); ability; ability = stok(NULL, " /t", &tok)) { mprAddKey(role->abilities, ability, role); } if (mprAddKey(auth->roles, name, role) == 0) { return 0; } return role;}
开发者ID:embedthis,项目名称:http,代码行数:21,
示例27: checkvoid check(char *str, char *ptr[], int size){ int t, i, d; if (scspn(str, size) > 0) { printf("Is SCP: no/n"); return; } for(i = 0; (str[i] != '/0'); i++) if(str[i] == ':') d++; if (d == 1) printf("Is SCP: yes/n"); else { printf("Is SCP: no/n"); return; } int j = stok(str, ':', ptr, size); for(i = 0; (str[i] != '/0'); i++) if(str[i] == '.') t++; if (t == 3) { for(i = 0; i < str[i] != '/0'; i++) if((str[i] >= '0' && str[i] <= '9') || (str[i] == '.')) t = 3; else { t = 4; break; } } char *ptr2[228]; int k = stok(str, '.', ptr2, size); isIp(ptr2, size, t); suntok(str, '.', ptr2, k); suntok(str, ':', ptr, j); process(str, size); output(str);}
开发者ID:simplex1337,项目名称:prog,代码行数:37,
示例28: CTESTCTEST(equation_suite, stok_single){ //Given char string[]= "haallo"; char *ptr[1]; stok(string, ptr); char *tmp1 = ptr[0]; //When const int real = tmp1[0]; //Then const int expct = 'h'; ASSERT_EQUAL(real, expct);}
开发者ID:ri57-sibsutis,项目名称:alphabet,代码行数:15,
示例29: processvoid process(char *pat, char *dir, char del){ char *RAW[MAXSIZE]; char *TOK[MAXSIZE]; char *a; int Z = 0, R = 0, i, j, k, dLEN, pLEN; pLEN = slen(pat); Z = stok(pat, del, RAW); dLEN = slen(dir); if (Z > 10) { printf("%sПо заданию программа не может обработать больше 10 путей%s/n", clBoldRed, clNormal); myexit(); } for (i = 0; i < Z; i++) { R = stok(RAW[i], '/', TOK); for (j = 0; j < R; j++) { if ((j == 0) && (slen(TOK[j]) > 1) && (TOK[j][0] == '~')) { for (a = pat + pLEN; a > TOK[j]; --a) *(a + dLEN) = *a; scpy(TOK[j], dir); *(TOK[j]+dLEN) = '/'; for (k = i + 1; k < Z; k++) RAW[k] += dLEN; for (k = j - 1; k < R; k++) TOK[k] += dLEN; } } suntok(RAW[i], '/', TOK, R); } suntok(pat, del, RAW, Z); return;}
开发者ID:DSG888,项目名称:SibSUTIS,代码行数:36,
注:本文中的stok函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ stop函数代码示例 C++ stof函数代码示例 |