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

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

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

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

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

示例1: gstor_open

/* OPEN * ------------------------------------------------------------------------- */struct gstor_open_retgstor_open(const char * name) {   struct gstor_open_ret ret;   string_t petri_filename = string_concat(name,".petri",0);   if (INVALID_STR(petri_filename)) goto error;   string_t dfile_filename = string_concat(name,".dfile",0);   if (INVALID_STR(dfile_filename)) goto error;   ret.gstor_h = malloc(sizeof(gstor));   ret.gstor_h->index = petri_open(string_tochar(petri_filename));   if (ret.gstor_h->index==0) goto error;   ret.gstor_h->data  = dfile_open(string_tochar(dfile_filename));   if (ret.gstor_h->data==0) goto close_and_error;   string_destroy(petri_filename);   string_destroy(dfile_filename);   return ret.result = GSTOR_OKAY, ret;close_and_error:   petri_close(ret.gstor_h->index);error:   return ret.result = GSTOR_ERROR, ret;}
开发者ID:nadlere,项目名称:expertdb,代码行数:27,


示例2: main

int main(int argc, char** argv){    struct string args;    int i;    int j;    int k;    string_init(&args, 1, 1);    string_concatb(&args, "foo", 3);    string_concatb(&args, "b", 1);    printf("%d/n", args._u._s.length);    for (i = 0; i < argc; i++) string_concat(&args, *argv++);    puts(string_get(&args));    string_free(&args);    for (j = 1; j <= 3; j++) {        for (k = 1; k <= 200; k+=50) {            printf("Testing with isize=%d growby=%d/n", j, k);            string_init(&args, j, k);            for (i = 0; i < 100; i++) {                string_concat(&args, "test");            }            printf("100x test == %d len, %d size, %d grow/n", args._u._s.length,                   args._u._s.size, args._u._s.growby);            string_free(&args);        }    }    return 0;}
开发者ID:99Frankie,项目名称:chaosvpn,代码行数:30,


示例3: string_split

char *get_path(char **env , char *cmd){  char **path;  char *dir_path;  int i;  char **unique_path;  char *concat_path;  char *cmd_path;  for (i = 0; env[i]!= '/0'; i++) /* Loops through each string in env ie each environment variable */  {    if(str_ncomp(env[i], "PATH=", str_len("PATH=")) == 0) /* Looks for a string containing "PATH=" */      {        path = string_split(env[i],'='); /* Separates the string found into 2 strings; "PATH" and what comes after */        dir_path = path[1]; /* The second string ie the whole path is stored */        unique_path = string_split(dir_path, ':'); /* The whole path contained in env var PATH is divided into all possible paths to search for input command */        break; /* Gets the unique_paths */      }  }  for(i = 0; unique_path[i] != '/0'; i++)   {     concat_path = string_concat(unique_path[i],"/"); /* "/" is appended to each unique path */     cmd_path = string_concat(concat_path, cmd); /* Input command is appended to each unique path */     if(find_ex(cmd_path)) /* If path to program to be executed is found */        return cmd_path;        cmd_path = '/0';   }   return NULL; /* If no path found */}
开发者ID:asaiapalacios,项目名称:holbertonschool-low_level_programming,代码行数:28,


示例4: cmd_insert

void cmd_insert (char *cp){    Line *line;    String *string;    if (range_single (cp, &cp, &cur_position) < 0) return;		/* see where to insert */    if (*cp == ';')  							/* if ;, insert the remaining string before current line */    {        cur_position.offset = 0;        string = string_create (strlen (cp + 1), cp + 1);        string_concat (string, 1, "/n");        buffer_dirty (cur_position.buffer, 1);        line_insert (cur_position.buffer, cur_position.line, string);        return;    }    if (!eoltest (cp)) return;						/* otherwise, that's all there should be */    /* Read tty input until eof into the current buffer just before the current line */    cur_position.offset = 0;    while ((string = jnl_readprompt ("/r/n               >")) != NULL)    {        string_concat (string, 1, "/n");					/* put line terminator on string */        buffer_dirty (cur_position.buffer, 1);        line_insert (cur_position.buffer, cur_position.line, string);	/* insert line just before current line */    }}
开发者ID:rroart,项目名称:freevms,代码行数:28,


示例5: InvalidArgumentException

void StringData::append(const char *s, int len) {  if (len == 0) return;  if (len < 0 || (len & IsMask)) {    throw InvalidArgumentException("len: %d", len);  }  ASSERT(!isStatic()); // never mess around with static strings!  if (!isMalloced()) {    int newlen;    m_data = string_concat(data(), size(), s, len, newlen);    if (isShared()) {      m_shared->decRef();    }    m_len = newlen;    m_hash = 0;  } else if (m_data == s) {    int newlen;    char *newdata = string_concat(data(), size(), s, len, newlen);    releaseData();    m_data = newdata;    m_len = newlen;  } else {    int dataLen = size();    ASSERT((m_data > s && m_data - s > len) ||           (m_data < s && s - m_data > dataLen)); // no overlapping    m_len = len + dataLen;    m_data = (const char*)realloc((void*)m_data, m_len + 1);    memcpy((void*)(m_data + dataLen), s, len);    ((char*)m_data)[m_len] = '/0';    m_hash = 0;  }}
开发者ID:mukulu,项目名称:hiphop-php,代码行数:34,


示例6: debugserver_format_command

static void debugserver_format_command(const char* prefix, const char* command, const char* arguments, int calculate_checksum, char** buffer, uint32_t* size){	char checksum_hash[DEBUGSERVER_CHECKSUM_HASH_LENGTH + 1] = {'#', '0', '0', '/0'};	char* encoded = NULL;	uint32_t encoded_length = 0;	if (arguments) {		/* arguments must be hex encoded */		debugserver_encode_string(arguments, &encoded, &encoded_length);	} else {		encoded = NULL;	}	char* encoded_command = string_concat(command, encoded, NULL);	encoded_length = strlen(encoded_command);	if (calculate_checksum) {		uint32_t checksum = debugserver_get_checksum_for_buffer(encoded_command, encoded_length);		checksum_hash[1] = DEBUGSERVER_HEX_ENCODE_FIRST_BYTE(checksum);		checksum_hash[2] = DEBUGSERVER_HEX_ENCODE_SECOND_BYTE(checksum);	}	*buffer = string_concat(prefix, encoded_command, checksum_hash, NULL);	*size = strlen(prefix) + strlen(encoded_command) + DEBUGSERVER_CHECKSUM_HASH_LENGTH;	debug_info("formatted command: %s size: %d checksum: 0x%s", *buffer, *size, checksum_hash);	if (encoded_command)		free(encoded_command);	if (encoded)		free(encoded);}
开发者ID:ifa6,项目名称:libimobiledevice,代码行数:33,


示例7: rtmsg_dump

static void rtmsg_dump(const uint8_t *buf, size_t len){  char str[80];  size_t i, off = 0;  int k = 0;  for(i=0; i<len; i++)    {      if(k == 20)	{	  printerror(0, NULL, __func__, "%s", str);	  k = 0;	  off = 0;	}      if(k != 0 && (k % 4) == 0)	string_concat(str, sizeof(str), &off, " ");      string_concat(str, sizeof(str), &off, "%02x", buf[i]);      k++;    }  if(k != 0)    printerror(0, NULL, __func__, "%s", str);  return;}
开发者ID:vbajpai,项目名称:scamper-cvs-20141101,代码行数:25,


示例8: string_concat

static char *tcp_pos(char *buf, size_t len, scamper_probe_t *probe){  size_t off = 0;  string_concat(buf, len, &off, "%u", probe->pr_tcp_seq);  if(probe->pr_tcp_flags & TH_ACK)    string_concat(buf, len, &off, ":%u", probe->pr_tcp_ack);  return buf;}
开发者ID:shinglee,项目名称:test,代码行数:8,


示例9: charDetection_blocks

char *charRecognition_getText(struct charRecognition *charReg,			      SDL_Surface *surface, char *dic){	char *recognized = "";	ImageBlockArray imageBlock = charDetection_blocks(surface);	for (unsigned h = 0; h < imageBlock.size; h++) {		ImageLineArray imageLine = imageBlock.elements[h].lines;		for (unsigned i = 0; i < imageLine.size; i++) {			char *curWord = "";			for (unsigned j = 0;			     j < imageLine.elements[i].chars.size; j++) {				struct ImageChar imageChar =				    imageLine.elements[i].chars.elements[j];				if (imageChar.space) {					if (strcmp(curWord, "") > 0)						recognized = string_concat(						    recognized,						    wordCorrector_correct(							dic, curWord));					curWord = "";					recognized =					    string_concat(recognized, " ");					continue;				}				SDL_Surface *s = image_scale(				    image_extractChar(surface, &imageChar), 16,				    16);				imageChar.content =				    charRecognition_getChar(charReg, s);				curWord = string_concatChar(				    curWord, tolower(charRecognition_getChar(						 charReg, s)));			}			if (strcmp(curWord, "") > 0)				recognized = string_concat(				    recognized,				    wordCorrector_correct(dic, curWord));			recognized = string_concat(recognized, "/n");		}		recognized = string_concat(recognized, "/n");	}	return recognized;}
开发者ID:LesOCR,项目名称:mediocr,代码行数:54,


示例10: switch

static char *tcp_flags(char *buf, size_t len, scamper_probe_t *probe){  uint8_t flags = probe->pr_tcp_flags;  uint8_t flag;  size_t off;  int i;  buf[0] = '/0';  if(probe->pr_len != 0)    flags &= ~(TH_ACK);  off = 0;  for(i=0; i<8 && flags != 0; i++)    {      flag = 1 << i;      if((flags & flag) == 0)	continue;      flags &= ~flag;      switch(flag)	{	case TH_SYN:	  string_concat(buf, len, &off, " syn");	  break;	case TH_RST:	  string_concat(buf, len, &off, " rst");	  break;	case TH_FIN:	  string_concat(buf, len, &off, " fin");	  break;	case TH_ACK:	  string_concat(buf, len, &off, " ack");	  break;	case TH_PUSH:	  string_concat(buf, len, &off, " psh");	  break;	case TH_URG:	  string_concat(buf, len, &off, " urg");	  break;	case TH_ECE:	  string_concat(buf, len, &off, " ece");	  break;	case TH_CWR:	  string_concat(buf, len, &off, " cwr");	  break;	}    }  return buf;}
开发者ID:shinglee,项目名称:test,代码行数:58,


示例11: string_concat_string

void string_concat_string(string* s, char* chars) { while(*chars) {  string_concat(s, *chars);  chars++; }}
开发者ID:mrkamel,项目名称:index-server,代码行数:7,


示例12: string_split

void string_split(string* s, array* a, char c) { string *current; int i; current = (string*)malloc(sizeof(string)); string_init(current); for(i = 0; i < s->used; i++) {  if(s->data[i] != c)   string_concat(current, s->data[i]);  else if(current->used) {   array_push(a, (int)current);   current = (string*)malloc(sizeof(string));   string_init(current);  } } if(current->used)  array_push(a, (int)current); else  free(current);}
开发者ID:mrkamel,项目名称:index-server,代码行数:25,


示例13: proxy_uri

static struct uri *proxy_uri(struct uri *uri, unsigned char *proxy,          struct connection_state *error_state){    struct string string;    if (init_string(&string)            && string_concat(&string, "proxy://", proxy, "/",                             (unsigned char *) NULL)            && add_uri_to_string(&string, uri, URI_BASE)) {        /* There is no need to use URI_BASE when calling get_uri()         * because URI_BASE should not add any fragments in the first         * place. */        uri = get_uri(string.source, 0);        /* XXX: Assume the problem is due to @proxy having bad format.         * This is a lot faster easier than checking the format. */        if (!uri)            *error_state = connection_state(S_PROXY_ERROR);    } else {        uri = NULL;        *error_state = connection_state(S_OUT_OF_MEM);    }    done_string(&string);    return uri;}
开发者ID:rkd77,项目名称:elinks-tv,代码行数:26,


示例14: main

int main(void) {	char* a = "hola ";	char* b = "mundo";	printf("%s/n", string_concat(a, b));	getchar();	char* concat = (char*) malloc(mallocSize(sizeof(char), strlen(a), strlen(b), -1));	string_concat_dinamyc(a, b, &concat);	printf("%s/n", concat);	getchar();	char* user = (char*) malloc(mallocSize(sizeof(char), 8, -1));	char* dominio = (char*) malloc(mallocSize(sizeof(char), 40, -1));	char* mail = "[email
C++ string_copy函数代码示例
C++ string_compare函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。