这篇教程C++ strend函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中strend函数的典型用法代码示例。如果您正苦于以下问题:C++ strend函数的具体用法?C++ strend怎么用?C++ strend使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了strend函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: whileinline bool xml_element::parse_head(string data) { data.qreplace("/t", " "); data.qreplace("/r", " "); data.qreplace("/n", " "); while(qstrpos(data, " ")) data.qreplace(" ", " "); data.qreplace(" =", "="); data.qreplace("= ", "="); data.rtrim(); lstring part; part.qsplit(" ", data); name = part[0]; if(name == "") throw "..."; for(unsigned i = 1; i < part.size(); i++) { lstring side; side.qsplit("=", part[i]); if(side.size() != 2) throw "..."; xml_attribute attr; attr.name = side[0]; attr.content = side[1]; if(strbegin(attr.content, "/"") && strend(attr.content, "/"")) attr.content.trim_once("/""); else if(strbegin(attr.content, "'") && strend(attr.content, "'")) attr.content.trim_once("'"); else throw "..."; attribute.append(attr); } return true;}
开发者ID:BadyRaty,项目名称:Mednafen-Core,代码行数:31,
示例2: strtrvoid Application::initPaths(const char *basename) { char temp[PATH_MAX]; if(realpath(basename, temp)) { //remove program name strtr(temp, "//", "/"); for(signed i = strlen(temp) - 1; i >= 0; i--) { if(temp[i] == '/') { temp[i] = 0; break; } } if(strend(temp, "/") == false) strcat(temp, "/"); config().path.base = temp; } else { config().path.base = ""; } if(userpath(temp)) { strtr(temp, "//", "/"); if(strend(temp, "/") == false) strcat(temp, "/"); config().path.user = temp; } else { config().path.user = ""; } char cwd[PATH_MAX]; config().path.startup = getcwd(cwd);}
开发者ID:BigEd,项目名称:snes-sdk,代码行数:30,
示例3: mainint main(void){ char *s1 = "some really long string."; char *s2 = "ng."; char *s3 = "ng"; if(strend(s1, s2)) { printf("The string (%s) has (%s) at the end./n", s1, s2); } else { printf("The string (%s) doesn't have (%s) at the end./n", s1, s2); } if(strend(s1, s3)) { printf("The string (%s) has (%s) at the end./n", s1, s3); } else { printf("The string (%s) doesn't have (%s) at the end./n", s1, s3); } return 0;}
开发者ID:HenryNi,项目名称:mycode,代码行数:25,
示例4: scan_nfs_shared_directoriesvoidscan_nfs_shared_directories(void){ FILE *exports; gint count = 0; gchar buf[512]; if (nfs_shares_list) { g_free(nfs_shares_list); } nfs_shares_list = g_strdup(""); if ((exports = fopen("/etc/exports", "r"))) { while (fgets(buf, 512, exports)) { if (buf[0] != '/') continue; strend(buf, ' '); strend(buf, '/t'); nfs_shares_list = h_strdup_cprintf("%s=/n", buf, nfs_shares_list); count++; } fclose(exports); } if (!count) { g_free(nfs_shares_list); nfs_shares_list = g_strdup("No NFS exports=/n"); }}
开发者ID:OpenAndrus,项目名称:Hardinfo-Muti-language,代码行数:35,
示例5: vUndovoidvUndo(void){ /* * Avoid UU which clobbers ability to do u. */ if (vundkind == VNONE || vundkind == VCAPU || vUNDdot != dot) { (void) beep(); return; } CP(vutmp, linebuf); vUD1 = linebuf; vUD2 = strend(linebuf); putmk1(dot, vUNDsav); getDOT(); vUA1 = linebuf; vUA2 = strend(linebuf); vundkind = VCAPU; if (state == ONEOPEN || state == HARDOPEN) { vjumpto(dot, vUNDcurs, 0); return; } vdirty(vcline, 1); if(MB_CUR_MAX > 1) rewrite = _ON; vsyncCL(); if(MB_CUR_MAX > 1) rewrite = _OFF; cursor = linebuf; vfixcurs();}
开发者ID:AlfredArouna,项目名称:illumos-gate,代码行数:30,
示例6: SetEngineSettingsInfostatic void SetEngineSettingsInfo(sreEngineSettingsInfo *info) { sprintf(scene_info_text_line[0], "SRE v0.4.4, %s, back-end: %s", opengl_str[info->opengl_version], sre_internal_backend->name); sprintf(scene_info_text_line[1], ""); sprintf(scene_info_text_line[2], "Resolution: %dx%d", info->window_width, info->window_height); sprintf(scene_info_text_line[3], "Multi-pass rendering: %s (press 6 or 7 to change)", no_yes_str[info->multi_pass_rendering]); sprintf(scene_info_text_line[4], "Reflection model: %s (4 5)", info->reflection_model_description); sprintf(scene_info_text_line[5], "Shadows setting: %s (1 2 3)", info->shadows_description); if (info->shadows_method == SRE_SHADOWS_SHADOW_VOLUMES) sprintf(strend(scene_info_text_line[5]), ", Shadow cache: %s", disabled_enabled_str[(info->rendering_flags & SRE_RENDERING_FLAG_SHADOW_CACHE_ENABLED) != 0]); const char *scissors_cache_description; if (info->scissors_method == SRE_SCISSORS_GEOMETRY) { if (info->rendering_flags & SRE_RENDERING_FLAG_GEOMETRY_SCISSORS_CACHE_ENABLED) scissors_cache_description = " Scissors cache enabled"; else scissors_cache_description = " Scissors cache disabled"; } else scissors_cache_description = ""; sprintf(scene_info_text_line[6], "Scissors optimization mode: %s (D S G)%s", info->scissors_description, scissors_cache_description); sprintf(scene_info_text_line[7], ""); sprintf(scene_info_text_line[8], "Max texture filtering anisotropy level: %.1f", info->max_anisotropy); sprintf(scene_info_text_line[9], ""); sprintf(scene_info_text_line[10], "HDR rendering: %s (F2 F3)", disabled_enabled_str[info->HDR_enabled]); if (info->HDR_enabled) sprintf(strend(scene_info_text_line[10]), ", Tone-mapping shader: %s (F4)", sreGetToneMappingShaderName(info->HDR_tone_mapping_shader)); sprintf(scene_info_text_line[11], ""); sprintf(scene_info_text_line[12], ""); sprintf(scene_info_text_line[13], "");}
开发者ID:hglm,项目名称:sre,代码行数:34,
示例7: symdirgetvoid symdirget(char *dir){ char buff[FN_REFLEN]; char *pos=strend(dir); if (dir[0] && pos[-1] != FN_DEVCHAR && access(dir, F_OK)) { FILE *fp; char temp= *(--pos); /* May be "/" or "/" */ strmov(pos,".sym"); fp = my_fopen(dir, O_RDONLY,MYF(0)); *pos++=temp; *pos=0; /* Restore old filename */ if (fp) { if (fgets(buff, sizeof(buff)-1, fp)) { for (pos=strend(buff); pos > buff && (iscntrl(pos[-1]) || isspace(pos[-1])) ; pos --); /* Ensure that the symlink ends with the directory symbol */ if (pos == buff || pos[-1] != FN_LIBCHAR) *pos++=FN_LIBCHAR; strmake(dir,buff, (uint) (pos-buff)); } my_fclose(fp,MYF(0)); } }}
开发者ID:OPSF,项目名称:uClinux,代码行数:29,
示例8: mainint main() { char *s = "abcdefg"; char *t1 = "efgh"; char *t2 = "fg"; printf("%d/n", mystrlen(s)); printf("%d/n", strend(s, t1)); printf("%d/n", strend(s, t2));}
开发者ID:gaopenghigh,项目名称:tcpl,代码行数:8,
示例9: mainint main(){ char *s = "A dog is a pet"; char *t1 = "pet"; char *t2 = "Adsgpet"; printf("%s/n%s/n", (strend(s, t1) ? "match" : "not match"), (strend(s, t2) ? "match" : "not match")); return 0;}
开发者ID:cloverstd,项目名称:The-C-Programming-Language,代码行数:9,
示例10: mainmain(){ int strend(char *, char *); char *s="TEST"; char *t="EST"; char *u="HOGE"; char *v="FUGAFUGA"; printf("%d/n",strend(s,t)); printf("%d/n",strend(u,v));}
开发者ID:nagahar,项目名称:kr,代码行数:11,
示例11: mainint main() { printf("Does 'the end' end with 'end'?/n"); int end = strend("the end", "end"); end ? printf("yes/n") : printf("no/n"); printf("Does 'the ending' end with 'end'?/n"); end = strend("the ending", "end"); end ? printf("yes/n") : printf("no/n"); printf("Does 'the end' end with 'an end'?/n"); end = strend("the end", "an end"); end ? printf("yes/n") : printf("no/n");}
开发者ID:jordandashel,项目名称:k-r,代码行数:13,
示例12: sprintf/* Try to find baseform (lemma) of individual word in POS */char *morphword(char *word, int pos){ int offset, cnt; int i; static char retval[WORDBUF]; char *tmp, tmpbuf[WORDBUF], *end; sprintf(retval,""); sprintf(tmpbuf, ""); end = ""; if(word == NULL) return(NULL); /* first look for word on exception list */ if((tmp = exc_lookup(word, pos)) != NULL) return(tmp); /* found it in exception list */ if (pos == ADV) { /* only use exception list for adverbs */ return(NULL); } if (pos == NOUN) { if (strend(word, "ful")) { cnt = strrchr(word, 'f') - word; strncat(tmpbuf, word, cnt); end = "ful"; } else /* check for noun ending with 'ss' or short words */ if (strend(word, "ss") || (strlen(word) <= 2)) return(NULL); }/* If not in exception list, try applying rules from tables */ if (tmpbuf[0] == '/0') strcpy(tmpbuf, word); offset = offsets[pos]; cnt = cnts[pos]; for(i = 0; i < cnt; i++){ strcpy(retval, wordbase(tmpbuf, (i + offset))); if(strcmp(retval, tmpbuf) && is_defined(retval, pos)) { strcat(retval, end); return(retval); } } return(NULL);}
开发者ID:Arnukk,项目名称:TDS,代码行数:51,
示例13: group_handle_normalstatic voidgroup_handle_normal(GKeyFile * key_file, ShellModuleEntry * entry, gchar * group, gchar ** keys){ GtkTreeIter parent; GtkTreeStore *store = GTK_TREE_STORE(shell->info->model); gchar *tmp = g_strdup(group); gint i; gtk_tree_store_append(store, &parent, NULL); strend(tmp, '#'); gtk_tree_store_set(store, &parent, INFO_TREE_COL_NAME, tmp, -1); g_free(tmp); for (i = 0; keys[i]; i++) { gchar *key = keys[i]; gchar *value; GtkTreeIter child; value = g_key_file_get_value(key_file, group, key, NULL); if (g_utf8_validate(key, -1, NULL) && g_utf8_validate(value, -1, NULL)) { gtk_tree_store_append(store, &child, &parent); gtk_tree_store_set(store, &child, INFO_TREE_COL_VALUE, value, -1); strend(key, '#'); if (*key == '$') { gchar **tmp; tmp = g_strsplit(++key, "$", 0); gtk_tree_store_set(store, &child, INFO_TREE_COL_NAME, tmp[1], INFO_TREE_COL_DATA, tmp[0], -1); g_strfreev(tmp); } else { gtk_tree_store_set(store, &child, INFO_TREE_COL_NAME, key, INFO_TREE_COL_DATA, NULL, -1); } g_hash_table_insert(update_tbl, g_strdup(key), gtk_tree_iter_copy(&child)); } g_free(value); }}
开发者ID:BackupTheBerlios,项目名称:hardinfo-svn,代码行数:50,
示例14: winscp_regular_requestint winscp_regular_request(char *request){ /* * winscp uses one of two requests to terminate each command. * we must determine which (if any) is terminating this request. fun! */ char *new_request=NULL; int retval=0; int retzero=1; new_request=strend(request, WINSCP_EOF_REQ_ZERO); if (NULL == new_request) { retzero=0; new_request=strend(request, WINSCP_EOF_REQ_STATUS); if (NULL == new_request) { new_request=strend(request, WINSCP_EOF_REQ_RETVAL); if (NULL == new_request) { printf ("command wasn't terminated with %s, %s or %s/n", WINSCP_EOF_REQ_RETVAL, WINSCP_EOF_REQ_ZERO, WINSCP_EOF_REQ_STATUS); return(-1); /* bogus termination */ } } } /* * here is where we fool winscp clients into believing we are a real shell */ if ((exact_match(new_request, "echo /"$status/"")) || (exact_match(new_request, "echo /"$?/""))) { printf ("0/n"); fflush(stdout); } /* * ignore unalias and unset commands */ else if ((NULL!=strbeg(new_request,"unset ")) || (NULL!=strbeg(new_request,"unalias "))) retval=0; else { retval=process_ssh_request(new_request); if (retzero) /* ignore actual retval if winscp wants us to */ retval=0; } free(new_request); return(retval);}
开发者ID:jonzobrist,项目名称:scponly,代码行数:49,
示例15: mainint main(){ char *s = "isch der Fisch"; char *t = "isch"; printf("%d/n", strend(s,t)); return 0;}
开发者ID:ahmaazouzi,项目名称:KR2_Answers,代码行数:7,
示例16: symdirgetvoid symdirget(char *dir){ char buff[FN_REFLEN+1]; char *pos=strend(dir); if (dir[0] && pos[-1] != FN_DEVCHAR && my_access(dir, F_OK)) { File file; size_t length; char temp= *(--pos); /* May be "/" or "/" */ strmov(pos,".sym"); file= my_open(dir, O_RDONLY, MYF(0)); *pos++=temp; *pos=0; /* Restore old filename */ if (file >= 0) { if ((length= my_read(file, buff, sizeof(buff) - 1, MYF(0))) > 0) { for (pos= buff + length ; pos > buff && (iscntrl(pos[-1]) || isspace(pos[-1])) ; pos --); /* Ensure that the symlink ends with the directory symbol */ if (pos == buff || pos[-1] != FN_LIBCHAR) *pos++=FN_LIBCHAR; strmake(dir,buff, (size_t) (pos-buff)); } my_close(file, MYF(0)); } }}
开发者ID:Dekadencee,项目名称:OregonCore,代码行数:30,
示例17: strcatc/****************************************************************************** * Function: void strcatc(char *str,char c) * * PreCondition: None * * Input: str - pointer to the zero terminated string * c - appendable character * * Output: None * * Side Effects: None * * Overview: Append one character to a zero terminated string * * Note: Using static variable for less code size *****************************************************************************/void strcatc(char *str,char c){ static char *s; s=strend(str); *s=c; s[1]=0;}
开发者ID:seppestas,项目名称:Wake-up-Robot-Server,代码行数:23,
示例18: my_redelint my_redel(const char *org_name, const char *tmp_name, myf MyFlags){ int error=1; DBUG_ENTER("my_redel"); DBUG_PRINT("my",("org_name: '%s' tmp_name: '%s' MyFlags: %d", org_name,tmp_name,MyFlags)); if (my_copystat(org_name,tmp_name,MyFlags) < 0) goto end; if (MyFlags & MY_REDEL_MAKE_BACKUP) { char name_buff[FN_REFLEN+20]; char ext[20]; ext[0]='-'; get_date(ext+1,2+4,(time_t) 0); strmov(strend(ext),REDEL_EXT); if (my_rename(org_name, fn_format(name_buff, org_name, "", ext, 2), MyFlags)) goto end; } else if (my_delete(org_name,MyFlags)) goto end; if (my_rename(tmp_name,org_name,MyFlags)) goto end; error=0;end: DBUG_RETURN(error);} /* my_redel */
开发者ID:OPSF,项目名称:uClinux,代码行数:29,
示例19: strendstatic const char *my_get_module_parent(char *buf, size_t size){ char *last= NULL; char *end; if (!GetModuleFileName(NULL, buf, (DWORD) size)) return NULL; end= strend(buf); /* Look for the second-to-last / in the filename, but hang on to a pointer after the last / in case we're in the root of a drive. */ for ( ; end > buf; end--) { if (*end == FN_LIBCHAR) { if (last) { /* Keep the last '/' as this works both with D:/ and a directory */ end[1]= 0; break; } last= end; } } return buf;}
开发者ID:ashang,项目名称:google-mysql,代码行数:29,
示例20: check_if_legal_filenameint check_if_legal_filename(const char *path){ const char *end; const char **reserved_name; DBUG_ENTER("check_if_legal_filename"); path+= dirname_length(path); /* To start of filename */ if (!(end= strchr(path, FN_EXTCHAR))) end= strend(path); if (path == end || (uint) (end - path) > MAX_RESERVED_NAME_LENGTH) DBUG_RETURN(0); /* Simplify inner loop */ for (reserved_name= reserved_names; *reserved_name; reserved_name++) { const char *reserved= *reserved_name; /* never empty */ const char *name= path; do { if (*reserved != my_toupper(&my_charset_latin1, *name)) break; if (++name == end && !reserved[1]) DBUG_RETURN(1); /* Found wrong path */ } while (*++reserved); } DBUG_RETURN(0);}
开发者ID:AtVirus,项目名称:SkyFireEMU,代码行数:27,
示例21: strlendmi_handle_list *dmidecode_match_value(const char *name, const char *value, const unsigned long *dmi_type) { dmi_handle_list *hl = NULL; gchar *full = NULL, *p = NULL, *next_nl = NULL; unsigned int ch = 0; int ln = 0, lnv = 0; if (!name) return NULL; ln = strlen(name); lnv = (value) ? strlen(value) : 0; full = dmidecode_read(dmi_type); if (full) { p = full; while(next_nl = strchr(p, '/n')) { strend(p, '/n'); if (!(sscanf(p, "Handle 0x%X", &ch) > 0) ) { while(*p == '/t') p++; if (strncmp(p, name, ln) == 0) { if (*(p + ln) == ':') { p = p + ln + 1; while(*p == ' ') p++; if (!value || strncmp(p, value, lnv) == 0) hl = dmi_handle_list_add(hl, ch); } } } p = next_nl + 1; } free(full); } return hl;}
开发者ID:lpereira,项目名称:hardinfo,代码行数:33,
示例22: finduservoidfinduser(register struct packet *pkt){ register char *p; char *user; char groupid[6]; int none; int ok_user; extern char saveid[]; none = 1;#if 0 user = logname();#else user = saveid;#endif sprintf(groupid,"%lu",(unsigned long)getgid()); while ((p = getline(pkt)) != NULL && *p != CTLCHAR) { none = 0; ok_user = 1; repl(p,'/n','/0'); /* this is done for equal test below */ if(*p == '!') { ++p; ok_user = 0; } if (!pkt->p_user) if (equal(user,p) || equal(groupid,p)) pkt->p_user = ok_user; *(strend(p)) = '/n'; /* repl /0 end of line w/ /n again */ } if (none) pkt->p_user = 1; if (p == NULL || p[1] != EUSERNAM) fmterr(pkt);}
开发者ID:rawiriblundell,项目名称:heirloom,代码行数:35,
示例23: moreinfo_handle_normalstatic voidmoreinfo_handle_normal(GKeyFile * key_file, gchar * group, gchar ** keys){ GtkTreeIter parent; GtkTreeStore *store = GTK_TREE_STORE(shell->moreinfo->model); gint i; gtk_tree_store_append(store, &parent, NULL); gtk_tree_store_set(store, &parent, INFO_TREE_COL_NAME, group, -1); for (i = 0; keys[i]; i++) { gchar *key = keys[i]; GtkTreeIter child; gchar *value; value = g_key_file_get_value(key_file, group, key, NULL); if (g_utf8_validate(key, -1, NULL) && g_utf8_validate(value, -1, NULL)) { strend(key, '#'); gtk_tree_store_append(store, &child, &parent); gtk_tree_store_set(store, &child, INFO_TREE_COL_VALUE, value, INFO_TREE_COL_NAME, key, -1); } g_free(value); }}
开发者ID:BackupTheBerlios,项目名称:hardinfo-svn,代码行数:28,
示例24: g_spawn_command_line_syncstatic usbd *usb_get_device_list_lsusb() { gboolean spawned; gchar *out, *err, *p, *next_nl; usbd *head = NULL, *nd; int bus, dev, vend, prod, ec; spawned = g_spawn_command_line_sync("lsusb", &out, &err, NULL, NULL); if (spawned) { p = out; while(next_nl = strchr(p, '/n')) { strend(p, '/n'); ec = sscanf(p, "Bus %d Device %d: ID %x:%x", &bus, &dev, &vend, &prod); if (ec == 4) { nd = usb_get_device(bus, dev); if (head == NULL) { head = nd; } else { usbd_list_append(head, nd); } } p = next_nl + 1; } g_free(out); g_free(err); } return head;}
开发者ID:lpereira,项目名称:hardinfo,代码行数:28,
示例25: mainint main() { char *s = "abcdef"; char *t = "def"; printf("%d/n", strend(s, t)); return 0;}
开发者ID:qrsrjm,项目名称:LearningC,代码行数:7,
示例26: mainmain(){ char s[] = "abcd efg hjkl"; char t[] = "fg hjkl"; printf("%d/n", strend(s, t));}
开发者ID:dboychev,项目名称:C,代码行数:7,
示例27: mainint main(){ char x[] = "World Hello"; char y[] = "ello"; int result1 = strend(x, y); printf("Should return 1:/n%d/n", result1); char a[] = "Hello World"; char b[] = "ello"; int result2 = strend(a, b); printf("Should return 0:/n%d/n", result2); return 0; }
开发者ID:Sabashan-Ragavan,项目名称:K-and-R-2nd-Edition-Solutions,代码行数:16,
示例28: sprintfchar *sti64cpy( // CONCATENATE I64 NUMBER char *tgt, // - target location signed_64 value ) // - value to be concatenated{ sprintf( tgt, "%lld", VAL64( value ) ); return strend( tgt );}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:7,
示例29: files inline lstring directory::files(const string &pathname, const string &pattern) { lstring list; string path = pathname; path.transform("/", "//"); if(!strend(path, "//")) path.append("//"); path.append("*"); HANDLE handle; WIN32_FIND_DATA data; handle = FindFirstFile(utf16_t(path), &data); if(handle != INVALID_HANDLE_VALUE) { if((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) { string name = utf8_t(data.cFileName); if(wildcard(name, pattern)) list.append(name); } while(FindNextFile(handle, &data) != false) { if((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) { string name = utf8_t(data.cFileName); if(wildcard(name, pattern)) list.append(name); } } FindClose(handle); } if(list.size() > 0) sort(&list[0], list.size()); return list; }
开发者ID:Arnethegreat,项目名称:bsnes-plus,代码行数:25,
示例30: mainint main(void) { char string1[MAX_STRING], string2[MAX_STRING]; int character, element; for (;;) { for (element = 0; element < MAX_STRING - 1 && (character = getchar()) != EOF && character != '/n'; ++element) string1[element] = character; string1[element] = '/0'; if (character == EOF) break; for (element = 0; element < MAX_STRING - 1 && (character = getchar()) != EOF && character != '/n'; ++element) string2[element] = character; string2[element] = '/0'; if (character == EOF) break; if (strend(string1, string2)) printf("The second string occurs at the end of the first string!/n"); else printf("The second string does not occur at the end of the first string.../n"); } return 0;}
开发者ID:DeadDork,项目名称:learning_c,代码行数:25,
注:本文中的strend函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ streq函数代码示例 C++ strempty函数代码示例 |