您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ string_printf函数代码示例

51自学网 2021-06-03 08:30:28
  C++
这篇教程C++ string_printf函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中string_printf函数的典型用法代码示例。如果您正苦于以下问题:C++ string_printf函数的具体用法?C++ string_printf怎么用?C++ string_printf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了string_printf函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: device_opencl_info

void device_opencl_info(vector<DeviceInfo>& devices){	vector<OpenCLPlatformDevice> usable_devices;	OpenCLInfo::get_usable_devices(&usable_devices);	/* Devices are numbered consecutively across platforms. */	int num_devices = 0;	foreach(OpenCLPlatformDevice& platform_device, usable_devices) {		const string& platform_name = platform_device.platform_name;		const cl_device_type device_type = platform_device.device_type;		const string& device_name = platform_device.device_name;		string hardware_id = platform_device.hardware_id;		if(hardware_id == "") {			hardware_id = string_printf("ID_%d", num_devices);		}		DeviceInfo info;		info.type = DEVICE_OPENCL;		info.description = string_remove_trademark(string(device_name));		info.num = num_devices;		/* We don't know if it's used for display, but assume it is. */		info.display_device = true;		info.advanced_shading = OpenCLInfo::kernel_use_advanced_shading(platform_name);		info.pack_images = true;		info.use_split_kernel = OpenCLInfo::kernel_use_split(platform_name,		                                                     device_type);		info.id = string("OPENCL_") + platform_name + "_" + device_name + "_" + hardware_id;		devices.push_back(info);		num_devices++;	}}
开发者ID:UPBGE,项目名称:blender,代码行数:30,


示例2: string_printf

void RedScreen::set_name(const std::string& name){    if (!name.empty()) {        string_printf(_name, name.c_str(), _id);    }    _window.set_title(_name);}
开发者ID:zhoupeng,项目名称:spice4xen,代码行数:7,


示例3: uri2string

char *uri2filename(UriUriA *uri){	char *furi_str = uri2string(uri);	char *newfilename = NULL;	if (!furi_str)		return NULL;	string_replace_with_char(furi_str, "//", *DIR_SEPAR_STR);	string_replace_with_char(furi_str, "/", *DIR_SEPAR_STR);#ifdef _WIN32	string_replace_with_char(furi_str, ":", '_');#endif	if (furi_str) {		string_printf(&newfilename, "%s%s", option_values.file_output_directory, furi_str);		if (newfilename[strlen(newfilename)-1] == *DIR_SEPAR_STR)			string_cat(&newfilename, "index.html");	}	string_free(furi_str);	return newfilename;}
开发者ID:ASpade,项目名称:mulk,代码行数:26,


示例4: load_kernels

	bool load_kernels(bool experimental)	{		/* check if cuda init succeeded */		if(cuContext == 0)			return false;		if(!support_device(experimental))			return false;		/* get kernel */		string cubin = compile_kernel();		if(cubin == "")			return false;		/* open module */		cuda_push_context();		CUresult result = cuModuleLoad(&cuModule, cubin.c_str());		if(cuda_error(result))			cuda_error(string_printf("Failed loading CUDA kernel %s.", cubin.c_str()));		cuda_pop_context();		return (result == CUDA_SUCCESS);	}
开发者ID:scorpion81,项目名称:blender-voro,代码行数:26,


示例5: string_nnew

char *get_host(UriUriA *uri){	char *ret_str = NULL;	int i, len = 0;	if (uri->hostData.ip4)		return *string_printf(&ret_str, "%d.%d.%d.%d", uri->hostData.ip4->data[0],			uri->hostData.ip4->data[1], uri->hostData.ip4->data[2], uri->hostData.ip4->data[3]);		if (uri->hostData.ip6) {		ret_str = string_alloc(40);		for (i = 0; i < 16; i++) {			len += sprintf(ret_str + len, "%2.2x", uri->hostData.ip6->data[i]);			if (i % 2 == 1 && i < 15)				ret_str[len++] = ':';		}		return ret_str;	}	if (uri->hostData.ipFuture.first) 		return string_nnew(uri->hostData.ipFuture.first,			uri->hostData.ipFuture.afterLast - uri->hostData.ipFuture.first);	if (uri->hostText.first) 		return string_nnew(uri->hostText.first, uri->hostText.afterLast - uri->hostText.first);	return NULL;}
开发者ID:ASpade,项目名称:mulk,代码行数:29,


示例6: add_aws_nodes

externvoid add_aws_nodes ( KConfig *self ){    char home [ 4096 ] = "";    size_t num_writ;    char path [ 4096 ];    rc_t rc;    check_env ( self, home, sizeof home );    /* if home environtment is found, create AWS root node */    if ( home [ 0 ] != 0 )    {        rc = string_printf ( path, sizeof path, &num_writ, "%s/.aws", home );        if ( rc == 0 && num_writ != 0 )        {            KConfigNode *aws_node;                        /* create aws node */            rc = KConfigOpenNodeUpdate ( self, &aws_node, "AWS", NULL );            if ( rc == 0 )                rc = aws_find_nodes ( aws_node, path );                        rc = KConfigNodeRelease ( aws_node );        }    }}
开发者ID:ncbi,项目名称:ncbi-vdb,代码行数:28,


示例7: write_to_file_cb

static bool CC write_to_file_cb( stat_row * row, void * f_data ){    write_ctx * wctx = ( write_ctx * ) f_data;    char buffer[ 256 ];    size_t num_writ;    rc_t rc = string_printf ( buffer, sizeof buffer, &num_writ,                                "%s/t%u/t%u/t%s/t%u/t%u/t%u/t%u/t%u/t%u/n",                                 row->spotgroup,                                 row->base_pos,                                row->n_read,                                row->dimer,                                row->gc_content,                                row->hp_run,                                row->max_qual_value,                                row->quality,                                row->count,                                row->mismatch_count );    if ( rc == 0 )    {        size_t f_writ;        rc = KFileWrite ( wctx->out, wctx->pos, buffer, num_writ, &f_writ );        if ( rc == 0 )        {            uint32_t percent = progressbar_percent( wctx->entries, ++wctx->lines, wctx->fract_digits );            update_progressbar( wctx->progress, percent );            wctx->pos += f_writ;        }    }    return ( rc == 0 );}
开发者ID:Bhumi28,项目名称:sra-tools,代码行数:32,


示例8: GuessedTimeZone

  GuessedTimeZone() {    time_t the_time = time(0);    struct tm tmbuf;    struct tm *ta = localtime_r(&the_time, &tmbuf);    const char *tzid = nullptr;    if (ta) {      tzid = timelib_timezone_id_from_abbr(ta->tm_zone, ta->tm_gmtoff,                                           ta->tm_isdst);    }    if (!tzid) {      tzid = "UTC";    }    m_tzid = tzid;#define DATE_TZ_ERRMSG /  "It is not safe to rely on the system's timezone settings. Please use " /  "the date.timezone setting, the TZ environment variable or the " /  "date_default_timezone_set() function. In case you used any of those " /  "methods and you are still getting this warning, you most likely " /  "misspelled the timezone identifier. "    string_printf(m_warning, DATE_TZ_ERRMSG                  "We selected '%s' for '%s/%.1f/%s' instead",                  tzid, ta ? ta->tm_zone : "Unknown",                  ta ? (float) (ta->tm_gmtoff / 3600) : 0,                  ta ? (ta->tm_isdst ? "DST" : "no DST") : "Unknown");  }
开发者ID:baidu-lamp,项目名称:baidu-hhvm-301,代码行数:27,


示例9: print_matchcount

static void print_matchcount( char * buffer, size_t buf_len, size_t *buf_idx, int *match_count ){    size_t num_writ;    string_printf( &buffer[ *buf_idx ], buf_len - *buf_idx, &num_writ,    "%d", *match_count );    *match_count = 0;    *buf_idx += num_writ;}
开发者ID:Bhumi28,项目名称:sra-tools,代码行数:7,


示例10: string_printf

static ShaderOutput *node_find_output_by_name(ShaderNode *node,                                              BL::Node& b_node,                                              BL::NodeSocket& b_socket){	string name = b_socket.name();	if(node_use_modified_socket_name(node)) {		BL::Node::outputs_iterator b_output;		bool found = false;		int counter = 0, total = 0;		for(b_node.outputs.begin(b_output); b_output != b_node.outputs.end(); ++b_output) {			if(b_output->name() == name) {				if(!found)					counter++;				total++;			}			if(b_output->ptr.data == b_socket.ptr.data)				found = true;		}		/* rename if needed */		if(name == "Shader")			name = "Closure";		if(total > 1)			name = string_printf("%s%d", name.c_str(), counter);	}	return node->output(name.c_str());}
开发者ID:DrangPo,项目名称:blender,代码行数:32,


示例11: HHVM_FUNCTION

Variant HHVM_FUNCTION(vprintf, const Variant& vformat, const Variant& args) {    String format = vformat.toString();    String output = string_printf(format.data(), format.size(), args.toArray());    if (output.isNull()) return false;    g_context->write(output.data(), output.size());    return output.size();}
开发者ID:lpathy,项目名称:hhvm,代码行数:7,


示例12: CConfigFile

//=============================================================================// y-func : Functions for Neutrino//=============================================================================//-------------------------------------------------------------------------// y-func : mount_get_list//-------------------------------------------------------------------------std::string  CNeutrinoYParser::func_mount_get_list(CyhookHandler *, std::string){	CConfigFile *Config = new CConfigFile(',');	std::string ysel, ytype, yip, ylocal_dir, ydir, ynr, yresult;	int yitype;	Config->loadConfig(NEUTRINO_CONFIGFILE);	for(unsigned int i=0; i <= 7; i++)	{		ynr=itoa(i);		ysel = ((i==0) ? "checked=/"checked/"" : "");		yitype = Config->getInt32("network_nfs_type_"+ynr,0);		ytype = ( (yitype==0) ? "NFS" :((yitype==1) ? "CIFS" : "FTPFS") );		yip = Config->getString("network_nfs_ip_"+ynr,"");		ydir = Config->getString("network_nfs_dir_"+ynr,"");		ylocal_dir = Config->getString("network_nfs_local_dir_"+ynr,"");		if(!ydir.empty())			ydir="("+ydir+")";		yresult += string_printf("<input type='radio' name='R1' value='%d' %s />%d %s - %s %s %s<br/>",			i,ysel.c_str(),i,ytype.c_str(),yip.c_str(),ylocal_dir.c_str(), ydir.c_str());	}	delete Config;	return yresult;}
开发者ID:zukon,项目名称:neutrino-mp-cst-next,代码行数:31,


示例13: KStsDefaultFormatter

staticrc_t CC KStsDefaultFormatter( void* self, KWrtHandler* writer,                              size_t argc, const wrt_nvp_t args[],                              size_t envc, const wrt_nvp_t envs[] ){    rc_t rc = 0;    size_t num_writ, nsize;    uint32_t mlen;    char buffer[8192], *nbuffer;    const char* msg, *mend;    /* if writer is null than silence */    if( writer == NULL || writer->writer == NULL ) {        return rc;    }    msg = wrt_nvp_find_value(envc, envs, "message");    if( msg != NULL ) {        mend = msg + strlen(msg);        /* strip trailing newlines */        while( mend != msg && (*mend == '/n' || *mend == '/r') ) {            --mend;        }        mlen = ( uint32_t ) ( mend - msg );    } else {        mlen = 0;    }    nbuffer = buffer;    nsize = sizeof(buffer);    do {        rc = string_printf(nbuffer, nsize, & num_writ, "%s %s.%s: %.*s/n",                                 wrt_nvp_find_value(envc, envs, "timestamp"),                                 wrt_nvp_find_value(envc, envs, "app"),                                 wrt_nvp_find_value(envc, envs, "version"),                                 ( uint32_t ) mlen, msg);        if( num_writ > nsize ) {            assert ( nbuffer == buffer );            nbuffer = malloc(nsize = num_writ + 2);            if( nbuffer == NULL ) {                rc = RC(rcRuntime, rcLog, rcLogging, rcMemory, rcExhausted);                break;            }            continue;        }        /* replace newlines with spaces, excluding last one */        for(nsize = 0; nsize < num_writ - 1; nsize++) {            if( nbuffer[nsize] == '/n' || nbuffer[nsize] == '/r' ) {                nbuffer[nsize] = ' ';            }        }        break;    } while(true);    if( rc == 0 ) {        rc = LogFlush(writer, nbuffer, num_writ);    }    if( nbuffer != buffer ) {        free(nbuffer);    }    return rc;}
开发者ID:ImAWolf,项目名称:ncbi-vdb,代码行数:60,


示例14: parse_SIZE

/* * parse_SIZE * * %SIZE(structure-attribute) * * Returns the number of addressable units that would * be allocated for a data segment with the specified * structure attribute. */static intparse_SIZE (parse_ctx_t pctx, void *vctx, quotelevel_t ql, lextype_t lt){    expr_ctx_t ctx = vctx;    lexeme_t *lex;    strudef_t *stru;    unsigned int units;    if (!parser_expect(pctx, QL_NORMAL, LEXTYPE_DELIM_LPAR, 0, 1)) {        expr_signal(ctx, STC__DELIMEXP, "(");        return 0;    }    units = 0;    if (!parser_expect(pctx, QL_NORMAL, LEXTYPE_NAME_STRUCTURE, &lex, 1)) {        expr_signal(ctx, STC__STRUNMEXP);        return 1;    }    if (!structure_allocate(ctx, lexeme_ctx_get(lex), &stru, &units, 0, 0)) {        expr_signal(ctx, STC__SYNTAXERR);    }    if (!parser_expect(pctx, QL_NORMAL, LEXTYPE_DELIM_RPAR, 0, 1)) {        expr_signal(ctx, STC__DELIMEXP, ")");    }    parser_insert(pctx, parser_lexeme_create(pctx, LEXTYPE_NUMERIC,                                             string_printf(expr_strctx(ctx), 0,                                                           "%u", units)));    return 1;} /* expr_parse_SIZE */
开发者ID:madisongh,项目名称:blissc,代码行数:40,


示例15: display_info

static void display_info(Progress& progress){	static double latency = 0.0;	static double last = 0;	double elapsed = time_dt();	string str, interactive;	latency = (elapsed - last);	last = elapsed;	int sample, tile;	double total_time, sample_time;	string status, substatus;	sample = progress.get_sample();	progress.get_tile(tile, total_time, sample_time);	progress.get_status(status, substatus);	if(substatus != "")		status += ": " + substatus;	interactive = options.interactive? "On":"Off";	str = string_printf("%s        Time: %.2f        Latency: %.4f        Sample: %d        Average: %.4f        Interactive: %s",						status.c_str(), total_time, latency, sample, sample_time, interactive.c_str());	view_display_info(str.c_str());	if(options.show_help)		view_display_help();}
开发者ID:Walid-Shouman,项目名称:Blender,代码行数:31,


示例16: enter_vdbcopy_node

static rc_t enter_vdbcopy_node( KMetadata *dst_meta, const bool show_meta ){    rc_t rc;    KMDataNode *hist_node;    if ( show_meta )        KOutMsg( "--- entering Copy entry.../n" );    rc = KMetadataOpenNodeUpdate ( dst_meta, &hist_node, "HISTORY" );    DISP_RC( rc, "enter_vdbcopy_node:KMetadataOpenNodeUpdate('HISTORY') failed" );    if ( rc == 0 )    {        char event_name[ 32 ];        uint32_t index = get_child_count( hist_node ) + 1;        rc = string_printf ( event_name, sizeof( event_name ), NULL, "EVENT_%u", index );        DISP_RC( rc, "enter_vdbcopy_node:string_printf(EVENT_NR) failed" );        if ( rc == 0 )        {            KMDataNode *event_node;            rc = KMDataNodeOpenNodeUpdate ( hist_node, &event_node, event_name );            DISP_RC( rc, "enter_vdbcopy_node:KMDataNodeOpenNodeUpdate('EVENT_NR') failed" );            if ( rc == 0 )            {                rc = enter_date_name_vers( event_node );                KMDataNodeRelease ( event_node );            }        }        KMDataNodeRelease ( hist_node );    }    return rc;}
开发者ID:gconcepcion,项目名称:sratoolkit,代码行数:31,


示例17: display_info

static void display_info(Progress& progress){	static double latency = 0.0;	static double last = 0;	double elapsed = time_dt();	string str;	latency = (elapsed - last);	last = elapsed;	int sample, tile;	double total_time, sample_time;	string status, substatus;	sample = progress.get_sample();	progress.get_tile(tile, total_time, sample_time);	progress.get_status(status, substatus);	if(substatus != "")		status += ": " + substatus;	str = string_printf("latency: %.4f        sample: %d        total: %.4f        average: %.4f        %s",		latency, sample, total_time, sample_time, status.c_str());	view_display_info(str.c_str());}
开发者ID:JasonWilkins,项目名称:blender-wayland,代码行数:26,


示例18: _doc_process_var

static void _doc_process_var(doc_ptr doc, cptr name){    if (strcmp(name, "version") == 0)    {        string_ptr s = string_alloc_format("%d.%d.%d", VER_MAJOR, VER_MINOR, VER_PATCH);        doc_insert(doc, string_buffer(s));        string_free(s);    }    else if (strlen(name) > 3 && strncmp(name, "FF_", 3) == 0)    {        char buf[100];        int  f_idx;        sprintf(buf, "%s", name + 3);        f_idx = f_tag_to_index(buf);        if (0 <= f_idx && f_idx < max_f_idx)        {            string_ptr s = string_alloc();            feature_type *feat = &f_info[f_idx];            string_printf(s, "<color:%c>%c</color>",                attr_to_attr_char(feat->d_attr[F_LIT_STANDARD]),                feat->d_char[F_LIT_STANDARD]);            doc_insert(doc, string_buffer(s));            string_free(s);        }    }}
开发者ID:Alkalinear,项目名称:poschengband,代码行数:30,


示例19: get_string_cell

static void get_string_cell( char * buffer, size_t buffer_size, const VTable * tab, int64_t row, const char * column ){    if ( has_col( tab, column ) )    {        const VCursor * cur;        rc_t rc = VTableCreateCursorRead( tab, &cur );        if ( rc == 0 )        {            uint32_t idx;            rc = VCursorAddColumn( cur, &idx, column );            if ( rc == 0 )            {                rc = VCursorOpen( cur );                if ( rc == 0 )                {                    const char * src;                    uint32_t row_len;                    rc = VCursorCellDataDirect( cur, row, idx, NULL, (const void**)&src, NULL, &row_len );                    if ( rc == 0 )                    {                        size_t num_writ;                        string_printf( buffer, buffer_size, &num_writ, "%.*s", row_len, src );                    }                }            }            VCursorRelease( cur );        }    }}
开发者ID:ncbi,项目名称:sra-tools,代码行数:29,


示例20: while

//-----------------------------------------------------------------------------// parse parameter string//       parameter               = attribute "=" value//       attribute               = token//       value                   = token | quoted-string//// 	If parameter attribute is multiple times given, the values are stored like this:// 		<attribute>=<value1>,<value2>,..,<value n>//-----------------------------------------------------------------------------bool CWebserverRequest::ParseParams(std::string param_string){	bool ende = false;	std::string param, name="", value, number;	while(!ende)	{		if(!ySplitStringExact(param_string,"&",param,param_string))			ende = true;		if(ySplitStringExact(param,"=",name,value))		{			name = decodeString(name);			value = trim(decodeString(value));			if(ParameterList[name].empty())				ParameterList[name] = value;			else			{				ParameterList[name] += ",";				ParameterList[name] += value;			}		}		else			name = trim(decodeString(name));		number = string_printf("%d", ParameterList.size()+1);		log_level_printf(7,"ParseParams: name: %s value: %s/n",name.c_str(), value.c_str());		ParameterList[number] = name;	}	return true;}
开发者ID:silid,项目名称:tuxbox-cvs-apps,代码行数:38,


示例21: ySplitString

//-------------------------------------------------------------------------// y-func : get_bouquets_as_dropdown [<bouquet>] <doshowhidden>//-------------------------------------------------------------------------std::string  CNeutrinoYParser::func_get_bouquets_as_dropdown(CyhookHandler *, std::string para){	std::string yresult, sel, nr_str, do_show_hidden;	int nr=1;	ySplitString(para," ",nr_str, do_show_hidden);	if(!nr_str.empty())		nr = atoi(nr_str.c_str());	int mode = NeutrinoAPI->Zapit->getMode();	for (int i = 0; i < (int) g_bouquetManager->Bouquets.size(); i++) {		//ZapitChannelList &channels = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->Bouquets[i]->radioChannels : g_bouquetManager->Bouquets[i]->tvChannels;		ZapitChannelList channels;		if (mode == CZapitClient::MODE_RADIO)			g_bouquetManager->Bouquets[i]->getRadioChannels(channels);		else			g_bouquetManager->Bouquets[i]->getTvChannels(channels);		sel=(nr==(i+1)) ? "selected=/"selected/"" : "";		if(!channels.empty() && (!g_bouquetManager->Bouquets[i]->bHidden || do_show_hidden == "true"))			yresult += string_printf("<option value=%u %s>%s</option>/n", i + 1, sel.c_str(),				std::string(g_bouquetManager->Bouquets[i]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) :g_bouquetManager->Bouquets[i]->Name.c_str()).c_str());			//yresult += string_printf("<option value=%u %s>%s</option>/n", i + 1, sel.c_str(), (encodeString(std::string(g_bouquetManager->Bouquets[i]->Name.c_str()))).c_str());	}	return yresult;}
开发者ID:zukon,项目名称:neutrino-mp-cst-next,代码行数:28,


示例22: test_encrypted

static void test_encrypted(string* x,string* y,string *pri) {    string mess,messb,encrypted_mess,xx,yy,tag;    INIT(mess);    INIT(messb);    INIT(encrypted_mess);    INIT(xx);    INIT(yy);    INIT(tag);    mess.len = 10;    mess.buf = (u8*)malloc(10);    mess.buf[0] = 'h';    mess.buf[1] = 'e';    mess.buf[2] = 'l';    mess.buf[3] = 'l';    mess.buf[4] = 'o';    mess.buf[5] = 'w';    mess.buf[6] = 'o';    mess.buf[7] = 'r';    mess.buf[8] = 'd';    mess.buf[9] = '/0';    int res;    printf("%s %d/n",__FILE__,__LINE__);    res = crypto_ECIES_encrypto_message(&mess,x,y,&xx,&yy,&encrypted_mess,&tag);    string_printf("xx",&xx);    string_printf("yy",&yy);    string_printf("encryptd_mess",&encrypted_mess);    string_printf("tag",&tag);    FILE *fd;    fd = fopen("encrypted_mess","w");    fwrite(encrypted_mess.buf,1,encrypted_mess.len,fd);    fd = fopen("xx","w");    fwrite(xx.buf,1,xx.len,fd);    fd = fopen("yy","w");    fwrite(yy.buf,1,yy.len,fd);    fd = fopen("tag","w");    fwrite(tag.buf,1,tag.len,fd);    if(res != 0) {        error();        return;    }    res = crypto_ECIES_decrypto_message(&encrypted_mess,&xx,&yy,&tag,pri,&messb);    printf("res :%d/n",res);}
开发者ID:ploce,项目名称:bdfnjhmdfbgb,代码行数:47,


示例23: num_gen_as_string_cb

static void CC num_gen_as_string_cb( void *item, void *data ){    char temp[40];    p_num_gen_node node = ( p_num_gen_node )item;    long unsigned int start = node->start;    long unsigned int end = ( start + node->count - 1 );    switch( node->count )    {    case 0 : temp[0]=0;             break;    case 1 : string_printf ( temp, sizeof temp, NULL, "%lu,", start );             break;    default: string_printf ( temp, sizeof temp, NULL, "%lu-%lu,", start, end );             break;    }    string_ctx_add( ( p_string_ctx )data, temp );}
开发者ID:zengfengbo,项目名称:sra-tools,代码行数:17,


示例24: ppscm_make_pp_type_error_exception

static SCMppscm_make_pp_type_error_exception (const char *message, SCM object){  std::string msg = string_printf ("%s: ~S", message);  return gdbscm_make_error (pp_type_error_symbol,			    NULL /* func */, msg.c_str (),			    scm_list_1 (object), scm_list_1 (object));}
开发者ID:mattstock,项目名称:binutils-bexkat1,代码行数:8,


示例25: i386_windows_core_pid_to_str

static std::stringi386_windows_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid){  if (ptid.lwp () != 0)    return string_printf ("Thread 0x%lx", ptid.lwp ());  return normal_pid_to_str (ptid);}
开发者ID:T-J-Teru,项目名称:binutils-gdb,代码行数:8,


示例26: url_encode

	lfl_string as_loadvars::create_request(const lfl_string& method, const lfl_string& uri, bool send_data)	{		lfl_string information;		//create information in the form of name=value (urlencoded)		string_hash<lfl_string>::iterator it = m_values.begin();		for(bool first = true; it != m_values.end(); ++it)		{			lfl_string name, value;			name = it->first;			value = it->second;			url_encode( &name );			url_encode( &value );			information += string_printf("%s%s=%s", first? "":"&",name.c_str(), value.c_str() );			first = false;		}		if( method == "POST")		{			lfl_string request = string_printf( "POST %s HTTP/1.1/r/n", uri.c_str() );			m_headers.set("Content-Length", string_printf( "%i", information.size()));			request += create_header();			request += "/r/n";			request += information;			return request;		}		else if(method == "GET")		{			lfl_string request = string_printf( "GET %s?%s HTTP/1.1/r/n", uri.c_str(), information.c_str() );			request += create_header();			request += "/r/n";			return request;		}		else		{			assert(0 && "unsupported");		}		return "";	}
开发者ID:xuxiandi,项目名称:LiquidFL,代码行数:45,


示例27: line_directive

static string line_directive(const string& path, int line){	string escaped_path = path;	string_replace(escaped_path, "/"", "///"");	string_replace(escaped_path, "/'", "///'");	string_replace(escaped_path, "/?", "///?");	string_replace(escaped_path, "//", "////");	return string_printf("#line %d /"%s/"", line, escaped_path.c_str());}
开发者ID:UPBGE,项目名称:blender,代码行数:9,


示例28: string_human_readable_size

string string_human_readable_size(size_t size){	static const char suffixes[] = "BKMGTPEZY";	const char* suffix = suffixes;	size_t r = 0;	while(size >= 1024) {		r = size % 1024;		size /= 1024;		suffix++;	}	if(*suffix != 'B')		return string_printf("%.2f%c", double(size*1024+r)/1024.0, *suffix);	else		return string_printf("%zu", size);}
开发者ID:JimStar,项目名称:OctaneBlender,代码行数:18,


示例29: indent

string NamedSizeStats::full_report(int indent_level){	const string indent(indent_level * kIndentNumSpaces, ' ');	const string double_indent = indent + indent;	string result = "";	result += string_printf("%sTotal memory: %s (%s)/n",	                        indent.c_str(),	                        string_human_readable_size(total_size).c_str(),	                        string_human_readable_number(total_size).c_str());	sort(entries.begin(), entries.end(), namedSizeEntryComparator);	foreach(const NamedSizeEntry& entry, entries) {		result += string_printf(		        "%s%-32s %s (%s)/n",		        double_indent.c_str(),		        entry.name.c_str(),		        string_human_readable_size(entry.size).c_str(),		        string_human_readable_number(entry.size).c_str());	}
开发者ID:Ichthyostega,项目名称:blender,代码行数:18,



注:本文中的string_printf函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ string_replace函数代码示例
C++ string_or_die函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。