这篇教程C++ tostring函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中tostring函数的典型用法代码示例。如果您正苦于以下问题:C++ tostring函数的具体用法?C++ tostring怎么用?C++ tostring使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了tostring函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: recinitvoid recinit(unsigned int n){ record = (char *) malloc(n); fields = (char *) malloc(n); fldtab = (Cell **) malloc((nfields+1) * sizeof(Cell *)); if (record == NULL || fields == NULL || fldtab == NULL) FATAL("out of space for $0 and fields"); fldtab[0] = (Cell *) malloc(sizeof (Cell)); *fldtab[0] = dollar0; fldtab[0]->sval = record; fldtab[0]->nval = tostring("0"); makefields(1, nfields);}
开发者ID:ajallooeian,项目名称:libawkcpp,代码行数:14,
示例2: makefieldsvoid makefields(int n1, int n2) /* create $n1..$n2 inclusive */{ char temp[50]; int i; for (i = n1; i <= n2; i++) { fldtab[i] = (Cell *) malloc(sizeof (struct Cell)); if (fldtab[i] == NULL) FATAL("out of space in makefields %d", i); *fldtab[i] = dollar1; snprintf(temp, sizeof temp, "%d", i); fldtab[i]->nval = tostring(temp); }}
开发者ID:darksoul42,项目名称:bitrig,代码行数:14,
示例3: fprintfstd::string FSM::GetEdgesString (int curstate) { std::string retval="/n"; if (nodes.size()<=curstate) { fprintf(stderr,"Error with faction relationship due to %d not being in range of faction/n",curstate); return "/n1. Transmit Error/n2. Transmit Error/n3. Transmit Error/n"; } for (unsigned int i=0;i<nodes[curstate].edges.size();i++) { retval+= tostring ((int)((i+1)%10))+"."+nodes[nodes[curstate].edges[i]].messages[0]+"/n"; } static bool print_docking=XMLSupport::parse_bool(vs_config->getVariable("graphics","hud","print_request_docking","true")); if (print_docking) retval+= "0. Request Docking Clearence"; return retval;}
开发者ID:bsmr-games,项目名称:Privateer-Gemini-Gold,代码行数:14,
示例4: switchNode *primary(void){ Node *np; switch (rtok) { case CHAR: np = op2(CHAR, NIL, itonp(rlxval)); rtok = relex(); return (unary(np)); case ALL: rtok = relex(); return (unary(op2(ALL, NIL, NIL))); case EMPTYRE: rtok = relex(); return (unary(op2(ALL, NIL, NIL))); case DOT: rtok = relex(); return (unary(op2(DOT, NIL, NIL))); case CCL: np = op2(CCL, NIL, (Node*) cclenter((char *) rlxstr)); rtok = relex(); return (unary(np)); case NCCL: np = op2(NCCL, NIL, (Node *) cclenter((char *) rlxstr)); rtok = relex(); return (unary(np)); case '^': rtok = relex(); return (unary(op2(CHAR, NIL, itonp(HAT)))); case '$': rtok = relex(); return (unary(op2(CHAR, NIL, NIL))); case '(': rtok = relex(); if (rtok == ')') { /* special pleading for () */ rtok = relex(); return unary(op2(CCL, NIL, (Node *) tostring(""))); } np = regexp(); if (rtok == ')') { rtok = relex(); return (unary(np)); } else FATAL("syntax error in regular expression %s at %s", lastre, prestr); default: FATAL("illegal primary in regular expression %s at %s", lastre, prestr); } return 0; /*NOTREACHED*/}
开发者ID:0xffea,项目名称:nawk,代码行数:50,
示例5: addBaseValuesstring Weapon::showXml () const{ CMarkup xml; xml.AddElem("weapon"); xml.IntoElem(); addBaseValues(xml); xml.AddElem("loaded_cliptype", loaded_cliptype_); xml.AddElem("ammo", tostring(ammo_)); return xml.GetDoc();}
开发者ID:TerminalHunter,项目名称:lunar-crime-squad,代码行数:14,
示例6: fl_path_cwdstatic value_t fl_path_cwd(value_t *args, uint32_t nargs){ if (nargs > 1) argcount("path.cwd", nargs, 1); if (nargs == 0) { char buf[1024]; get_cwd(buf, sizeof(buf)); return string_from_cstr(buf); } char *ptr = tostring(args[0], "path.cwd"); if (set_cwd(ptr)) lerrorf(IOError, "path.cwd: could not cd to %s", ptr); return FL_T;}
开发者ID:BenoitKnecht,项目名称:julia,代码行数:14,
示例7: fl_time_fromstringstatic value_t fl_time_fromstring(value_t *args, uint32_t nargs){#if defined WIN32 return 0;#else argcount("time.fromstring", nargs, 1); char *ptr = tostring(args[0], "time.fromstring"); double t = parsetime(ptr); int64_t it = (int64_t)t; if ((double)it == t && fits_fixnum(it)) return fixnum(it); return mk_double(t);#endif}
开发者ID:orangeloaf,项目名称:nebelung,代码行数:14,
示例8: mainint main(){ int i; char buffer[100]; printf("Please enter an integer/n"); getLine(buffer, 100); i = tonumber (buffer); buffer[0] = '/0'; tostring(i, buffer); printf("The number is %s /n", buffer); return 0;}
开发者ID:jennykang,项目名称:K-R,代码行数:14,
示例9: FATALchar *cclenter(const char *argp) /* add a character class */{ int i, c, c2; int j; uschar *p = (uschar *) argp; uschar *op, *bp; static uschar *buf = 0; static int bufsz = 100; op = p; if (buf == 0 && (buf = (uschar *) malloc(bufsz)) == NULL) FATAL("out of space for character class [%.10s...] 1", p); bp = buf; for (i = 0; (c = *p++) != 0; ) { if (c == '//') { c = quoted(&p); } else if (c == '-' && i > 0 && bp[-1] != 0) { if (*p != 0) { c = bp[-1]; c2 = *p++; if (c2 == '//') c2 = quoted(&p); if (collate_range_cmp(c, c2) > 0) { bp--; i--; continue; } for (j = 0; j < NCHARS; j++) { if ((collate_range_cmp(c, j) > 0) || collate_range_cmp(j, c2) > 0) continue; if (!adjbuf((char **) &buf, &bufsz, bp-buf+2, 100, (char **) &bp, "cclenter1")) FATAL("out of space for character class [%.10s...] 2", p); *bp++ = j; i++; } continue; } } if (!adjbuf((char **) &buf, &bufsz, bp-buf+2, 100, (char **) &bp, "cclenter2")) FATAL("out of space for character class [%.10s...] 3", p); *bp++ = c; i++; } *bp = 0; dprintf( ("cclenter: in = |%s|, out = |%s|/n", op, buf) ); xfree(op); return (char *) tostring((char *) buf);}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:49,
示例10: api_hexchat_unhookstatic int api_hexchat_unhook(lua_State *L){ hook_info **info = (hook_info **)luaL_checkudata(L, 1, "hook"); if(*info) { unregister_hook(*info); *info = 0; return 0; } else { tostring(L, 1); return luaL_error(L, "hook %s is already unhooked", lua_tostring(L, -1)); }}
开发者ID:Cynede,项目名称:hexchat,代码行数:15,
示例11: initedUOSkill::UOSkill( const Package* pkg, ConfigElem& elem ) : inited(true), skillid( strtoul( elem.rest(), NULL, 10 ) ), attributename(elem.remove_string( "Attribute", "" )), pAttr(NULL), pkg(pkg){ if (skillid < 0 || skillid >= 500) elem.throw_error( "SkillID must be < 500" ); if (!attributename.empty()) { bool required = false; if (attributename[0] == '+') { required = true; attributename = attributename.substr( 1, std::string::npos ); } pAttr = FindAttribute( attributename ); if (!pAttr) { if (required) { elem.throw_error( "Attribute " + tostring(attributename) + " not found." ); } else { elem.warn( "Attribute " + tostring(attributename) + " not found." ); } } }}
开发者ID:alucardxlx,项目名称:polserver-zulu,代码行数:36,
示例12: dprintfchar *setsval(register cell *vp, const char *s){ dprintf("setsval: %lo %s/n", (long)vp, s); checkval(vp); if (vp == recloc) error(FATAL, "can't set $0"); vp->tval &= ~NUM; vp->tval |= STR; if ((vp->tval & FLD) && isnull(vp->nval)) donerec = 0; if (!(vp->tval&FLD)) strfree(vp->sval); vp->tval &= ~FLD; return(vp->sval = tostring(s));}
开发者ID:Sunshine-OS,项目名称:svr4-userland,代码行数:15,
示例13: luaV_concatvoid luaV_concat (lua_State *L, int total, int last) { do { StkId top = L->base + last + 1; int n = 2; /* number of elements handled in this pass (at least 2) */ if (!(ttisstring(top-2) || ttisnumber(top-2)) || !tostring(L, top-1)) { if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT)) luaG_concaterror(L, top-2, top-1); } else if (tsvalue(top-1)->len == 0) /* second op is empty? */ (void)tostring(L, top - 2); /* result is first op (as string) */ else { /* at least two string values; get as many as possible */ size_t tl = tsvalue(top-1)->len; char *buffer; int i; /* collect total length */ for (n = 1; n < total && tostring(L, top-n-1); n++) { size_t l = tsvalue(top-n-1)->len; if (l >= MAX_SIZET - tl) luaG_runerror(L, "string length overflow"); tl += l; } buffer = luaZ_openspace(L, &G(L)->buff, tl); tl = 0; for (i=n; i>0; i--) { /* concat all strings */ size_t l = tsvalue(top-i)->len; memcpy(buffer+tl, svalue(top-i), l); tl += l;#if LUA_REFCOUNT luarc_cleanvalue(top-i);#endif /* LUA_REFCOUNT */ } setsvalue2s(L, top-n, luaS_newlstr(L, buffer, tl)); } total -= n-1; /* got `n' strings to create 1 new */ last -= n-1; } while (total > 1); /* repeat until only 1 result left */}
开发者ID:zapline,项目名称:zlib,代码行数:36,
示例14: sprintfCell *awksprintf(Node **a, int n) /* sprintf(a[0]) */{ Cell *x; Node *y; char buf[3*RECSIZE]; y = a[0]->nnext; x = execute(a[0]); if (format(buf, sizeof buf, getsval(x), y) == -1) ERROR "sprintf string %.30s... too long", buf FATAL; tempfree(x); x = gettemp(); x->sval = tostring(buf); x->tval = STR; return(x);}
开发者ID:ajallooeian,项目名称:libawkcpp,代码行数:16,
示例15: tostring//MYCONTACTvoid MyContact::OnChange(int prop){ if (prop == Contact::P_AVAILABILITY) { SEString name; if (!GetPropDisplayname(name)) throw SkypeException("Can't obtain display name./n"); Contact::AVAILABILITY availability; if (!GetPropAvailability(availability)) throw SkypeException("Can't obtain availability status./n"); SEString statusAsText; statusAsText = tostring(availability); printf("[SKYPE]: %s -> %s/n", (const char*)name, (const char*)statusAsText); };}
开发者ID:jizecn,项目名称:srs_ui_pro,代码行数:17,
示例16: api_hexchat_printstatic int api_hexchat_print(lua_State *L){ int i, args = lua_gettop(L); luaL_Buffer b; luaL_buffinit(L, &b); for(i = 1; i <= args; i++) { if(i != 1) luaL_addstring(&b, " "); tostring(L, i); luaL_addvalue(&b); } luaL_pushresult(&b); hexchat_print(ph, lua_tostring(L, -1)); return 0;}
开发者ID:Cynede,项目名称:hexchat,代码行数:16,
示例17: ProcScreenNamebool ProcScreenName( void )/*************************/{ if( !GetToken( SEP_NO, TOK_INCLUDE_DOT ) ) { return( false ); } if( Token.len > MAX_SCREEN_NAME_LENGTH ) { LnkMsg( LOC+LINE+WRN+MSG_VALUE_TOO_LARGE, "s", "screenname" ); } else { if( FmtData.u.nov.screenname != NULL ) { _LnkFree( FmtData.u.nov.screenname ); // assume second is correct. } FmtData.u.nov.screenname = tostring(); } return( true );}
开发者ID:Azarien,项目名称:open-watcom-v2,代码行数:16,
示例18: ifvoid AccountEx::OnChange(int prop) { if (prop == Account::P_STATUS) { Account::STATUS loginStatus; this->GetPropStatus(loginStatus); if (loginStatus == Account::LOGGED_IN) { // printf("Login complete./n"); m_LoggedIn = true; } else if (loginStatus == Account::LOGGED_OUT) { Account::LOGOUTREASON whyLogout; this->GetPropLogoutreason(whyLogout); printf("%s/n", (const char*)tostring(whyLogout)); m_LoggedOut = true; printf("Logout complete./n"); } }}
开发者ID:ysuga,项目名称:SkypeRTC,代码行数:16,
示例19: cyrussasl_sasl_server_startstatic int cyrussasl_sasl_server_start(lua_State *l){ int numargs = lua_gettop(l); int err; struct _sasl_ctx *ctx = NULL; const char *mech = NULL; const char *data = NULL; size_t len; unsigned outlen; if (numargs != 3) { lua_pushstring(l, "usage: " "(err, data) = cyrussasl.server_start(conn, mech, data)"); lua_error(l); return 0; } /* Pull arguments off of the stack... */ ctx = get_context(l, 1); mech = tostring(l, 2); /* Allow the 'data' param to be nil, or an empty string. */ if ( lua_type(l, 3) == LUA_TNIL ) { data = NULL; len = 0; } else { data = tolstring(l, 3, &len); } err = sasl_server_start( ctx->conn, /* saved sasl connection */ mech, /* mech, which the client chose */ data, /* data that the client sent */ len, /* length of the client's data */ &data, /* data with which the server will reply */ &outlen /* size of the server's reply */ ); /* Form the reply and push onto the stack */ lua_pushinteger(l, err); /* SASL_CONTINUE, SASL_OK, et al */ if (data) { lua_pushlstring(l, data, outlen); /* server's reply to the client */ } else { lua_pushnil(l); } return 2; /* returning 2 items on Lua stack */}
开发者ID:JorjBauer,项目名称:lua-cyrussasl,代码行数:47,
示例20: load_skill_entryvoid load_skill_entry( const Package* pkg, ConfigElem& elem ){ UOSkill uoskill( pkg, elem ); if ( uoskill.skillid >= uo_skills.size() ) uo_skills.resize( uoskill.skillid+1 ); if ( uo_skills[uoskill.skillid].inited ) { elem.throw_error( "UOSkill " + tostring(uoskill.skillid) + " already defined by " + uo_skills[uoskill.skillid].pkg->desc() ); } uo_skills[ uoskill.skillid ] = uoskill;}
开发者ID:alucardxlx,项目名称:polserver-zulu,代码行数:17,
示例21: FATALchar *cclenter(const char *argp) /* add a character class */{ int i, c, c2; uschar *p = (uschar *) argp; uschar *op, *bp; static uschar *buf = 0; static int bufsz = 100; op = p; if (buf == 0 && (buf = (uschar *) malloc(bufsz)) == NULL) FATAL("out of space for character class [%.10s...] 1", p); bp = buf; for (i = 0; (c = *p++) != 0; ) { if (c == '//') { c = quoted((char **) &p); } else if (c == '-' && i > 0 && bp[-1] != 0) { if (*p != 0) { c = bp[-1]; c2 = *p++; if (c2 == '//') c2 = quoted((char **) &p); if (c > c2) { /* empty; ignore */ bp--; i--; continue; } while (c < c2) { if (!adjbuf((char **) &buf, &bufsz, bp-buf+2, 100, (char **) &bp, "cclenter1")) FATAL("out of space for character class [%.10s...] 2", p); *bp++ = ++c; i++; } continue; } } if (!adjbuf((char **) &buf, &bufsz, bp-buf+2, 100, (char **) &bp, "cclenter2")) FATAL("out of space for character class [%.10s...] 3", p); *bp++ = c; i++; } *bp = 0; dprintf( ("cclenter: in = |%s|, out = |%s|/n", op, buf) ); xfree(op); return (char *) tostring((char *) buf);}
开发者ID:zodsoft,项目名称:android-platform-ndk,代码行数:45,
示例22: fl_path_cwdstatic value_t fl_path_cwd(value_t *args, uint32_t nargs){ uv_err_t err; if (nargs > 1) argcount("path.cwd", nargs, 1); if (nargs == 0) { char buf[1024]; err = uv_cwd(buf, sizeof(buf)); if (err.code != UV_OK) lerrorf(IOError, "path.cwd: could not get cwd: %s", uv_strerror(err)); return string_from_cstr(buf); } char *ptr = tostring(args[0], "path.cwd"); err = uv_chdir(ptr); if (err.code != UV_OK) lerrorf(IOError, "path.cwd: could not cd to %s: %s", ptr, uv_strerror(err)); return FL_T;}
开发者ID:HarlanH,项目名称:julia,代码行数:18,
示例23: parse_ipv4addrparse_result parse_ipv4addr(char const * str) { parse_result addr[4]; addr[0]=parse_int_dec(str); addr[1]=parse_int_dec(addr[0].rest+1); addr[2]=parse_int_dec(addr[1].rest+1); addr[3]=parse_int_dec(addr[2].rest+1); if ( addr[0].result && in_range(*(int*)addr[0].result, 0, 256) && addr[1].result && in_range(*(int*)addr[1].result, 0, 256) && addr[2].result && in_range(*(int*)addr[2].result, 0, 256) && addr[3].result && in_range(*(int*)addr[3].result, 0, 256) && addr[0].rest && (*addr[0].rest=='.') && addr[1].rest && (*addr[1].rest=='.') && addr[2].rest && (*addr[2].rest=='.')) { size_t len=addr[3].rest-str+1; return make_parse_result(tostring(take_string(len, fullstr(str))), addr[3].rest); } else return make_parse_result(NULL, str);}
开发者ID:eldesh,项目名称:gopts,代码行数:19,
示例24: cyrussasl_sasl_decode64/* data = cyrussasl.decode64(b64data) * * Partner function to encode64(). */static int cyrussasl_sasl_decode64(lua_State *l){ const char *data = NULL; char *outdata = NULL; size_t len; unsigned outlen; int err; int numargs = lua_gettop(l); if (numargs != 1) { lua_pushstring(l, "usage: data = cyrussasl.decode64(b64data)"); lua_error(l); return 0; } data = tostring(l, 1); len = strlen(data); outdata = malloc(len); if (!outdata) { lua_pushstring(l, "failed to malloc in decode64"); lua_error(l); return 0; } /* Perform a decode-in-place, which is kosher according to docs. */ err = sasl_decode64(data, len, outdata, len, &outlen); if ( err != SASL_OK ) { free(outdata); lua_pushstring(l, "sasl_decode64 failed"); lua_error(l); return 0; } if (outdata) { lua_pushlstring(l, outdata, outlen); } else { lua_pushnil(l); } free(outdata); return 1;}
开发者ID:JorjBauer,项目名称:lua-cyrussasl,代码行数:46,
示例25: definitionvoiddefinition(char *s) /* collect definition for s and install *//* char *s; definitions picked up lexically */{ char *p; struct symtab *stp; p = delimstr("definition"); stp = lookup(s); if (stp == NULL) /* it's not there already */ stp = newvar(tostring(s), DEFNAME); else { if (stp->s_type != DEFNAME) { yyerror("%s used as variable and definition", s); return; } free(stp->s_val.p); } stp->s_val.p = p;}
开发者ID:n-t-roff,项目名称:DWB3.3,代码行数:20,
示例26: bvAdd/** * [bvAdd description] * @param root [description] * @param pos [description] * @return [description] */Node* bvAdd(Node* root, int pos) { Node* p = root; //string strL, strR; //strL = data1[pos][p->left->index]; //strR = data1[pos][p->right->index]; string pNode = tostring("v"); data1[pos].push_back(pNode); int index = data1[pos].size(); createAddTree(p, index, pos); p->oprtype = 1; p->index = index-1; p->left = NULL; p-> right = NULL; return p;}
开发者ID:wujunzero,项目名称:bit-blasting,代码行数:26,
示例27: copyvoid copy(void) /* begin input from file, etc. */{ FILE *fin; if (newfile) { if ((fin = fopen(newfile, "r")) == NULL) ERROR "can't open file %s", newfile FATAL; curfile++; curfile->fin = fin; curfile->fname = tostring(newfile); curfile->lineno = 0; printf(".lf 1 %s/n", curfile->fname); pushsrc(File, curfile->fname); newfile = 0; } if (thrudef) { thru = 1; begin = 1; /* wrong place */ }}
开发者ID:n-t-roff,项目名称:9front_troff,代码行数:20,
示例28: syminitvoidsyminit(void){ setsymtab("0", tostring("0"), 0.0, NUM|STR|CON|FLD, symtab); /* this one is used for if(x)... tests: */ setsymtab("$zero&null", tostring(""), 0.0, NUM|STR|CON|FLD, symtab); recloc = setsymtab("$record", record, 0.0, STR|FLD, symtab); dprintf("recloc %lo lookup %lo/n", (long)recloc, (long)lookup("$record", symtab, 0)); FS = &setsymtab("FS", tostring(" "), 0.0, STR|FLD, symtab)->sval; RS = &setsymtab("RS", tostring("/n"), 0.0, STR|FLD, symtab)->sval; OFS = &setsymtab("OFS", tostring(" "), 0.0, STR|FLD, symtab)->sval; ORS = &setsymtab("ORS", tostring("/n"), 0.0, STR|FLD, symtab)->sval; OFMT = &setsymtab("OFMT", tostring("%.6g"), 0.0, STR|FLD, symtab)->sval; FILENAME = &setsymtab("FILENAME", EMPTY, 0.0, STR|FLD, symtab)->sval; nfloc = setsymtab("NF", EMPTY, 0.0, NUM, symtab); NF = &nfloc->fval; nrloc = setsymtab("NR", EMPTY, 0.0, NUM, symtab); NR = &nrloc->fval;}
开发者ID:Sunshine-OS,项目名称:svr4-userland,代码行数:19,
示例29: framesidevoid frameside(int type, Attr *desc) /* create and remember sides */{ int n; char buf[100]; nsides++; switch (type) { case 0: /* no side specified; kludge up all */ frameside(TOP, desc); frameside(BOT, desc); frameside(LEFT, desc); frameside(RIGHT, desc); return; case TOP: n = 0; break; case BOT: n = 1; break; case LEFT: n = 2; break; case RIGHT: n = 3; break; } sprintf(buf, "%s %s", sides[n], desc_str(desc)); newsides[n] = tostring(buf);}
开发者ID:AustenConrad,项目名称:plan-9,代码行数:21,
注:本文中的tostring函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ total函数代码示例 C++ tostate函数代码示例 |