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

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

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

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

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

示例1: parse_extended_opts

static void parse_extended_opts(e2fsck_t ctx, const char *opts){	char	*buf, *token, *next, *p, *arg;	int	ea_ver;	int	extended_usage = 0;	buf = string_copy(ctx, opts, 0);	for (token = buf; token && *token; token = next) {		p = strchr(token, ',');		next = 0;		if (p) {			*p = 0;			next = p+1;		} 		arg = strchr(token, '=');		if (arg) {			*arg = 0;			arg++;		}		if (strcmp(token, "ea_ver") == 0) {			if (!arg) {				extended_usage++;				continue;			}			ea_ver = strtoul(arg, &p, 0);			if (*p ||			    ((ea_ver != 1) && (ea_ver != 2))) {				fprintf(stderr,					_("Invalid EA version./n"));				extended_usage++;				continue;			}			ctx->ext_attr_ver = ea_ver;		} else {			fprintf(stderr, _("Unknown extended option: %s/n"),				token);			extended_usage++;		}	}	if (extended_usage) {		fputs(("/nExtended options are separated by commas, "		       "and may take an argument which/n"		       "is set off by an equals ('=') sign.  "			"Valid extended options are:/n"		       "/tea_ver=<ea_version (1 or 2)>/n/n"), stderr);		exit(1);	}}	
开发者ID:TELE-TWIN,项目名称:livebox2,代码行数:48,


示例2: system_hostid

uint64_t system_hostid( void ){#if FOUNDATION_PLATFORM_ANDROID    //Not implemented yet, see https://code.google.com/p/libjingle/source/browse/trunk/talk/base/ifaddrs-android.cc    return 0;#else    struct ifaddrs* ifaddr;    struct ifaddrs* ifa;    uint64_t hostid = 0;#if !FOUNDATION_PLATFORM_APPLE    struct ifreq buffer;    int sock = socket( PF_INET, SOCK_DGRAM, 0 );#endif    if( getifaddrs( &ifaddr ) == 0 )    {        for( ifa = ifaddr; ifa && !hostid; ifa = ifa->ifa_next )        {            if( string_equal_substr( ifa->ifa_name, "lo", 2 ) )                continue;#if FOUNDATION_PLATFORM_APPLE            hostid = _system_hostid_lookup( ifa );#else            memset( &buffer, 0, sizeof( buffer ) );            string_copy( buffer.ifr_name, ifa->ifa_name, sizeof( buffer.ifr_name ) );            hostid = _system_hostid_lookup( sock, &buffer );#endif        }        freeifaddrs( ifaddr );    }#if !FOUNDATION_PLATFORM_APPLE    else    {        memset( &buffer, 0, sizeof( buffer ) );        strcpy( buffer.ifr_name, "eth0" );        hostid = _system_hostid_lookup( sock, &buffer );    }    close( sock );#endif    return hostid;#endif}
开发者ID:apprisi,项目名称:foundation_lib,代码行数:48,


示例3: blob_request

static enum requestblob_request(struct view *view, enum request request, struct line *line){	switch (request) {	case REQ_VIEW_BLAME:		if (view->parent)			string_copy(view->env->ref, view->parent->vid);		return request;	case REQ_EDIT:		open_blob_editor(view->vid, NULL, (line - view->line) + 1);		return REQ_NONE;	default:		return pager_request(view, request, line);	}}
开发者ID:jlsandell,项目名称:tig,代码行数:16,


示例4: path_tmpfile

OBJECT * path_tmpfile(void){    OBJECT * result = 0;    OBJECT * tmpnam;    string file_path;    string_copy(&file_path,path_tmpdir());    string_push_back(&file_path,PATH_DELIM);    tmpnam = path_tmpnam();    string_append(&file_path,object_str(tmpnam));    object_free(tmpnam);    result = object_new(file_path.value);    string_free(&file_path);    return result;}
开发者ID:cpascal,项目名称:af-cpp,代码行数:16,


示例5: string_resize

int string_resize (char ** string, int new_size){    if (string == NULL)    {        return 0;    }    char * new_string = new char[new_size + 1];    memset (new_string, 0, new_size + 1);    string_copy( * string, new_string);    if (* string != NULL)    {        delete [] * string;    }    * string = new_string;    return string_length(* string);}
开发者ID:AltenaMonk,项目名称:TestWork,代码行数:16,


示例6: get_phases_real_path

voidget_phases_real_path (void) {#ifdef PATH_MAX       char pathstr[PATH_MAX];#else       char pathstr[4096];#endif       phases_t i;       for (i = P_NONE; i < P_LAST; i++) {               if (!phase_info[i].dir) { continue; }               char* p = realpath (phase_info[i].dir, pathstr);               if (p && strcmp (p, phase_info[i].dir)) {                       phase_info[i].dir = string_copy (p);               }       }}
开发者ID:prabindh,项目名称:openuh,代码行数:16,


示例7: perform_split

void perform_split(const char* str, const int output_size,                  const int string_size, char** output, char** error,                  const int i, const int last_split, const int output_index) {  // First check errors.  int size = i - last_split;  if (size > string_size) {    *error = "string_size not large enough";  }  if (output_index > output_size - 1) {    *error = "output_size not large enough";  }  // Otherwise we're good!  string_copy(&str[last_split], size, output[output_index]);}
开发者ID:dzelemba,项目名称:cs452,代码行数:16,


示例8: libusbp_device_copy

libusbp_error * libusbp_device_copy(const libusbp_device * source, libusbp_device ** dest){    if (dest == NULL)    {        return error_create("Device output pointer is null.");    }    *dest = NULL;    if (source == NULL)    {        return NULL;    }    libusbp_error * error = NULL;    // Allocate the device.    libusbp_device * new_device = NULL;    if (error == NULL)    {        error = device_allocate(&new_device);    }    // Copy the simple fields, while leaving the pointers owned by the    // device NULL so that libusbp_device_free is still OK to call.    if (error == NULL)    {        memcpy(new_device, source, sizeof(libusbp_device));        new_device->serial_number = NULL;    }    // Copy the serial number.    if (error == NULL && source->serial_number != NULL)    {        error = string_copy(source->serial_number, &new_device->serial_number);    }    // Pass the device to the caller.    if (error == NULL)    {        *dest = new_device;        new_device = NULL;    }    libusbp_device_free(new_device);    return error;}
开发者ID:pololu,项目名称:libusbp,代码行数:47,


示例9: bind_sounds_to_context

/*!   Associate the sounds in the _name_ array with the  sound context sound_context.  If more than one sound is specified,  then a sound will be chosen randomly from the list each time the  sound is played.  If num_sounds == 0, then the entry for the sound  context is deleted.  /pre     /c sound_context != NULL  /arg /c  sound_context sound context to bind sounds to  /arg /c  names list of sound names to bind to context  /arg /c  num_sounds number of elements in /c names  /return  none  /author  jfpatry  /date    Created:  2000-08-13  /date    Modified: 2000-08-14*/void bind_sounds_to_context( char *sound_context, char **names, int num_sounds ){    int i;    sound_context_data_t *data;    check_assertion( initialized_, "audio module not initialized" );    if ( get_hash_entry( sound_contexts_, sound_context, 			 (hash_entry_t*) &data ) )    {	/* Entry for this context already exists; decrement ref_cts &	   delete arrays */	for (i=0; i<data->num_sounds; i++) {	    decr_sound_data_ref_ctr( data->sound_names[i] );	    free( data->sound_names[i] );	}	free( data->sound_names );	free( data->chunks );	del_hash_entry( sound_contexts_, sound_context, NULL );    } else {	data = (sound_context_data_t*)malloc( sizeof(sound_context_data_t) );    }    if ( num_sounds == 0 ) {	/* delete the context */	free( data );	return;    }    check_assertion( num_sounds > 0, "num_sounds isn't > 0 " );    data->num_sounds = num_sounds;    data->sound_names = (char**)malloc( sizeof(char*)*num_sounds );    data->chunks = (Mix_Chunk**)malloc( sizeof(Mix_Chunk*)*num_sounds );    data->loop_count = 0;    data->channel = 0;    data->volume = 128;    for (i=0; i<num_sounds; i++) {	data->sound_names[i] = string_copy( names[i] );	incr_sound_data_ref_ctr( names[i] );	data->chunks[i] = NULL;    }    add_hash_entry( sound_contexts_, sound_context, (hash_entry_t)data );}
开发者ID:LeifAndersen,项目名称:TuxRider,代码行数:64,


示例10: libusbp_device_get_os_id

libusbp_error * libusbp_device_get_os_id(    const libusbp_device * device, char ** id){    if (id == NULL)    {        return error_create("Device OS ID output pointer is null.");    }    *id = NULL;    if (device == NULL)    {        return error_create("Device is null.");    }    return string_copy(device->device_instance_id, id);}
开发者ID:pololu,项目名称:libusbp,代码行数:17,


示例11: blast_client_send_handshake

static intblast_client_send_handshake(blast_client_t* client, blast_reader_t* reader) {	int iaddr, addrsize = 0;	socket_t** socks;	const network_address_t** addrarr;	packet_handshake_t packet;	packet.type = PACKET_HANDSHAKE;	packet.token = 0;	packet.timestamp = blast_timestamp(client->begin_send);	packet.datasize = reader->size;	packet.seq = blast_seq(client->seq++);	packet.namesize = (uint32_t)string_copy(packet.name, sizeof(packet.name),	                                        STRING_ARGS(reader->name)).length;	if (client->target) {		addrarr = &client->target;		socks = &client->sock;		addrsize = 1;	}	else {		addrarr = (const network_address_t**)client->address;		socks = client->socks;		addrsize = array_size(addrarr);	}	for (iaddr = 0; iaddr < addrsize; ++iaddr) {		udp_socket_sendto(socks[iaddr],		                  &packet, sizeof(packet_handshake_t) - (PACKET_NAME_MAXSIZE - packet.namesize) + 1,		                  addrarr[iaddr]);#if BUILD_ENABLE_LOG		{			char buffer[NETWORK_ADDRESS_NUMERIC_MAX_LENGTH];			string_t addr = network_address_to_string(buffer, sizeof(buffer), addrarr[iaddr], true);			log_infof(HASH_BLAST, STRING_CONST("Sent handshake to %.*s (seq %lld, timestamp %lld)"),			          STRING_FORMAT(addr), packet.seq,			          (tick_t)packet.timestamp);		}#endif	}	client->last_send = time_current();	return 0;}
开发者ID:harish-agr,项目名称:network_lib,代码行数:46,


示例12: nis0_find

static intnis0_find(void *handle, uschar *filename, const uschar *keystring, int length,  uschar **result, uschar **errmsg, uint *do_cache){int rc;uschar *nis_data;int nis_data_length;do_cache = do_cache;   /* Placate picky compilers */if ((rc = yp_match(CCS handle, CCS filename, CCS keystring, length + 1,    CSS &nis_data, &nis_data_length)) == 0)  {  *result = string_copy(nis_data);  (*result)[nis_data_length] = 0;    /* remove final '/n' */  return OK;  }return (rc == YPERR_KEY || rc == YPERR_MAP)? FAIL : DEFER;}
开发者ID:Exim,项目名称:exim,代码行数:17,


示例13: string_domain_alabel_to_utf8

uschar *string_domain_alabel_to_utf8(const uschar * alabel, uschar ** err){uschar * s1;uschar * s;int rc;if (  (rc = idna_to_unicode_8z8z(CCS alabel, CSS &s1, IDNA_USE_STD3_ASCII_RULES))   != IDNA_SUCCESS)  {  if (err) *err = US idna_strerror(rc);  return NULL;  }s = string_copy(s1);free(s1);return s;}
开发者ID:CforED,项目名称:Exim-Development-Repository,代码行数:17,


示例14: f_sql_column_names

/************************************************************************* * f_sql_column_names( int handle )                                       * * returns the returned column names of the last executed statement *************************************************************************/svalue_t *f_sql_column_names( svalue_t * argv, int argc ){#if ODBC_DEBUG & DEBUG_FUNC   printf( "call f_sql_column_names( )/n" );#endif   int  id, cnt, i;   hDBC * handle;   vector_t    * vec;   TYPE_TEST1( argv, T_NUMBER );   id = argv->u.number;   free_svalue( argv );   if ( !(handle = get_db_connection_by_id( id )) ) {      errorf( "Illegal handle for database./n" );      return( NULL );   }   if ( !handle->columns ) {      vec = allocate_array( 0 );      MEM_CHECK( vec );      put_array( argv, vec );      return( argv );   }   cnt = handle->colcnt;   vec = allocate_array( cnt );   MEM_CHECK( vec );   for ( i = 0; i < cnt; ++i ) {      if ( handle->columns[ i ] )         put_malloced_string(vec->item + i, string_copy(  handle->columns[ i ]->name ) );   }   put_array( argv, vec );#if ODBC_DEBUG & DEBUG_FUNC   printf( "ret f_sql_column_names( )/n" );#endif   return( argv );}
开发者ID:Fuchur,项目名称:ldmud,代码行数:51,


示例15: for

/*!   Associate the music with name _name_ to the music context  _music_context_.  If _name_ is NULL or the null string, the data for  the music context will be deleted.  /pre     /c music_context != /c NULL  /arg /c  music_context music context to bind sounds to  /arg /c  name name of music to bind to context  /arg /c  loop number of loops to play music for (-1 to loop forever)  /return  none  /author  jfpatry  /date    Created:  2000-08-13  /date Modified: 2000-08-14 */void bind_music_to_context( char *music_context, char *name, int loop ){    music_context_data_t *data;    check_assertion( initialized_, "audio module not initialized" );    if ( get_hash_entry( music_contexts_, music_context, 			 (hash_entry_t*) &data ) )    {	/* Entry for this context already exists; decrement ref count &	   delete string */	/* check if music is playing, stop if it is */	if ( current_music_name_ != NULL && 	     strcmp( current_music_name_, data->music_name ) == 0 )	{	    Mix_HaltMusic();	    current_music_name_ = NULL;	    current_music_data_ = NULL;	    check_assertion( get_music_playing_status( data->music_name ),			     "inconsistent music playing status info" );	    set_music_playing_status( data->music_name, False );	}	decr_music_data_ref_ctr( data->music_name );	free( data->music_name );	del_hash_entry( music_contexts_, music_context, NULL );    } else {	data = (music_context_data_t*)malloc( sizeof(music_context_data_t) );    }    if ( name == NULL || name[0]=='/0' ) {	/* delete the context */	free( data );	return;    }    data->music_name = string_copy( name );    incr_music_data_ref_ctr( name );    data->music = NULL;    data->loop = loop;    add_hash_entry( music_contexts_, music_context, (hash_entry_t)data );}
开发者ID:LeifAndersen,项目名称:TuxRider,代码行数:59,


示例16: f77name

/*****************************************************************************  *                              M R B H D R                                  * *****************************************************************************/ftnword f77name(mrbhdr)(word *buf, ftnword *f_temps,			ftnword *f_flgs, char *f_stnid,			ftnword *f_idtyp, ftnword *f_lati, ftnword *f_lon,			ftnword *f_dx, ftnword *f_dy, ftnword *f_elev,			ftnword *f_drcv, ftnword *f_date, ftnword *f_oars,			ftnword *f_run, ftnword *f_nblk,			ftnword *f_sup, ftnword *f_nsup,			ftnword *f_xaux, ftnword *f_nxaux, int ll1){int temps, flgs, idtyp, lati, lon;int dx, dy,elev, drcv, date, oars, run, nblk;int nsup=*f_nsup, nxaux=*f_nxaux;char stnid[11] = {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','/0'};int ier, l1;#if defined(NEC64)   BUF_C;   ier = c_mrbhdr(buf+1, &temps, &flgs, stnid, &idtyp,		  &lati, &lon, &dx, &dy, &elev,		  &drcv, &date, &oars, &run, &nblk,		  (word *)f_sup, nsup, (word *)f_xaux, nxaux);   BUF_F;#else   ier = c_mrbhdr(buf, &temps, &flgs, stnid, &idtyp,		  &lati, &lon, &dx, &dy, &elev,		  &drcv, &date, &oars, &run, &nblk,		  (word *)f_sup, nsup, (word *)f_xaux, nxaux);#endif   *f_temps = (ftnword) temps;   *f_flgs = (ftnword) flgs;   *f_idtyp = (ftnword) idtyp;   *f_lati  = (ftnword) lati;   *f_lon = (ftnword) lon;   *f_dx = (ftnword) dx;   *f_dy = (ftnword) dy;   *f_elev = (ftnword) elev;   *f_drcv = (ftnword) drcv;   *f_date = (ftnword) date;   *f_oars = (ftnword) oars;   *f_run = (ftnword) run;   *f_nblk = (ftnword) nblk;   l1 = (ll1 > 11) ? 11: ll1;   string_copy(f_stnid,stnid,l1);   return((ftnword) ier);}
开发者ID:armnlib,项目名称:librmn,代码行数:48,


示例17: vds_rinsert

rc_t vds_rinsert( p_dump_str s, const char *s1 ){    size_t len;    if ( ( s == NULL )||( s1 == NULL ) )    {        return RC( rcVDB, rcNoTarg, rcInserting, rcParam, rcNull );    }    len = string_size( s1 );    if ( len == 0 )    {        return RC( rcVDB, rcNoTarg, rcInserting, rcParam, rcEmpty );    }    if ( s->str_len <= len ) return 0;    len = s->str_len - len;    string_copy( s->buf + len, sizeof( s->buf ) - len, s1, string_size( s1 ) );    /* s->str_len does not change */    return 0;}
开发者ID:Bhumi28,项目名称:sra-tools,代码行数:18,


示例18: string_copy

static char *find_fsck(char *type){  char *s;  const char *tpl;  static char prog[256];  char *p = string_copy(fsck_path);  struct stat st;    tpl = (strncmp(type, "fsck.", 5) ? "%s/fsck.%s" : "%s/%s");  for(s = strtok(p, ":"); s; s = strtok(NULL, ":")) {	sprintf(prog, tpl, s, type);	if (stat(prog, &st) == 0) break;  }  free(p);  return(s ? prog : NULL);}
开发者ID:qtekfun,项目名称:htcDesire820Kernel,代码行数:18,


示例19: generate_lookup

/** * Performs code-generation for a lookup node. */int generate_lookup(Pool *pool, FILE *out, AstLookup *p){  int rv;  /* If a tag satisfies the lookup, generate that: */  rv = generate_lookup_tag(pool, out, p);  if (rv == 1) return 1;  if (rv == 0) return 0;  /* If that didn't work, try the built-in transforms: */  if (generate_lookup_builtin(pool, out, p))    return 1;  source_location(stderr, p->name.p);  fprintf(stderr, "error: Could not find a transform named /"%s/"./n",    string_copy(pool, p->name).p);  return 0;}
开发者ID:swansontec,项目名称:outline2c,代码行数:21,


示例20: generate_map

/** * Performs code-generation for a map statement. */int generate_map(Pool *pool, FILE *out, AstMap *p){  ListNode *line;  /* Match against the map: */  for (line = p->lines; line; line = line->next) {    AstMapLine *l = ast_to_map_line(line->d);    if (test_filter(l->filter, p->item)) {      CHECK(generate_code(pool, out, l->code));      return 1;    }  }  /* Nothing matched: */  fprintf(stderr, "error: Could not match item /"%s/" against map./n",    string_copy(pool, p->item->name).p);  return 0;}
开发者ID:swansontec,项目名称:outline2c,代码行数:21,


示例21: tls_cert_serial_number

uschar *tls_cert_serial_number(void * cert, uschar * mod){    uschar bin[50], txt[150];    size_t sz = sizeof(bin);    uschar * sp;    uschar * dp;    int ret;    if ((ret = gnutls_x509_crt_get_serial((gnutls_x509_crt_t)cert,                                          bin, &sz)))        return g_err("gs0", __FUNCTION__, ret);    for(dp = txt, sp = bin; sz; dp += 2, sp++, sz--)        sprintf(dp, "%.2x", *sp);    for(sp = txt; sp[0]=='0' && sp[1]; ) sp++;	/* leading zeroes */    return string_copy(sp);}
开发者ID:toddr,项目名称:exim,代码行数:18,


示例22: downcase_list

static LIST* downcase_list( LIST *in ){    LIST* result = 0;        string s[1];    string_new( s );            while (in)    {        string_copy( s, in->string );        downcase_inplace( s->value );        result = list_append( result, list_new( 0, newstr( s->value ) ) );        in = in->next;    }        string_free( s );    return result;}
开发者ID:gorkinovich,项目名称:DefendersOfMankind,代码行数:18,


示例23: libusbp_serial_port_get_name

libusbp_error * libusbp_serial_port_get_name(    const libusbp_serial_port * port,    char ** name){    if (name == NULL)    {        return error_create("String output pointer is null.");    }    *name = NULL;    if (port == NULL)    {        return error_create("Serial port is null.");    }    return string_copy(port->port_name, name);}
开发者ID:pololu,项目名称:libusbp,代码行数:18,


示例24: string_copy

/* Find fsck program for a given fs type. */static char *find_fsck(char *type){  char *s;  const char *tpl;  char *p = string_copy(fsck_path);  struct stat st;  /* Are we looking for a program or just a type? */  tpl = (strncmp(type, "fsck.", 5) ? "%s/fsck.%s" : "%s/%s");  for(s = strtok(p, ":"); s; s = strtok(NULL, ":")) {	s = xasprintf(tpl, s, type);	if (stat(s, &st) == 0) break;	free(s);  }  free(p);  return s;}
开发者ID:emuikernel,项目名称:WNR2000v4,代码行数:19,


示例25: interpret_type

/* * Interpret filesystem auto type if necessary */static void interpret_type(struct fs_info *fs){	const char	*type;		if (strcmp(fs->type, "auto") == 0 ||	    (strchr(fs->type, ',') != 0)) {		if (fs && strchr(fs->device, '='))			fs->device = interpret_device(fs->device);		type = identify_fs(fs->device, fs->type);		if (type) {			free(fs->type);			fs->type = string_copy(type);		} else			fprintf(stderr, _("Could not determine "					  "filesystem type for %s/n"),				fs->device);	}}
开发者ID:DentonGentry,项目名称:gfiber-gfrg100,代码行数:21,


示例26: system_hostid

uint64_t system_hostid( void ){	struct ifaddrs* ifaddr;	struct ifaddrs* ifa;	uint64_t hostid = 0;#if !FOUNDATION_PLATFORM_APPLE	struct ifreq buffer;	int sock = socket( PF_INET, SOCK_DGRAM, 0 );#endif		if( getifaddrs( &ifaddr ) == 0 )	{		for( ifa = ifaddr; ifa && !hostid; ifa = ifa->ifa_next )		{			if( string_equal_substr( ifa->ifa_name, "lo", 2 ) )				continue;			#if FOUNDATION_PLATFORM_APPLE						#else			memset( &buffer, 0, sizeof( buffer ) );			string_copy( buffer.ifr_name, ifa->ifa_name, sizeof( buffer.ifr_name ) );			hostid = _system_hostid_lookup( sock, &buffer );#endif		}		freeifaddrs( ifaddr );	}#if !FOUNDATION_PLATFORM_APPLE	else	{		memset( &buffer, 0, sizeof( buffer ) );		strcpy( buffer.ifr_name, "eth0" );		hostid = _system_hostid_lookup( sock, &buffer );	}	close( sock );#endif		return hostid;}
开发者ID:NocturnDragon,项目名称:foundation_lib,代码行数:44,


示例27: extract_diagnostics_info

/************************************************************************* * extracts the dignosticinfo of an handle. *************************************************************************/static char *extract_diagnostics_info( SQLSMALLINT type, SQLHANDLE handle ){   char       ** tmp;   char       * ret;   int        i,              j = 0;   SQLINTEGER recnum;      SQLGetDiagField( type, handle, 0, SQL_DIAG_NUMBER, &recnum, SQL_IS_INTEGER, 0 );   if ( !recnum )      return( NULL );   tmp = pxalloc( recnum * sizeof( tmp ) );   SQLCHAR     state[ 7 ];   SQLINTEGER  native;   SQLCHAR     text[1000],               buffer[1000];   SQLSMALLINT len;  for ( i = 0; i < recnum; i++ ) {      SQLGetDiagRec( type, handle, i+1, state, &native, text, sizeof( text ), &len );      sprintf( buffer, "[%5s]%s/n", state, text );      tmp[ i ] = string_copy( buffer );      j += strlen( tmp[ i ] );   }      ret = pxalloc( (j + 1) * sizeof( char ) );   for ( i = 0; i < recnum; i++ ) {      if( i ) {         strcat( ret, tmp[ i ] );      } else {         strcpy( ret, tmp[ i ] );      }      pfree( tmp[ i ] );   }      pfree( tmp );   return( ret );}
开发者ID:Fuchur,项目名称:ldmud,代码行数:47,


示例28: main

int main(void){    int n;    char a[SIZE], b[SIZE];    printf("文字列(空白
C++ string_dup函数代码示例
C++ string_concat函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。