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

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

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

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

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

示例1: add_library

/* add specified library to the list of files */static void add_library( strarray *lib_dirs, strarray *files, const char *library ){    char *static_lib, *fullname = 0;    switch(get_lib_type(lib_dirs, library, &fullname))    {    case file_arh:        strarray_add(files, strmake("-a%s", fullname));        break;    case file_dll:        strarray_add(files, strmake("-d%s", fullname));        if ((static_lib = find_static_lib(fullname)))        {            strarray_add(files, strmake("-a%s",static_lib));            free(static_lib);        }        break;    case file_so:    default:        /* keep it anyway, the linker may know what to do with it */        strarray_add(files, strmake("-l%s", library));        break;    }    free(fullname);}
开发者ID:WASSUM,项目名称:longene_travel,代码行数:26,


示例2: get_temp_file

static char* get_temp_file(const char* prefix, const char* suffix){    int fd;    char* tmp = strmake("%s-XXXXXX%s", prefix, suffix);#ifdef HAVE_SIGPROCMASK    sigset_t old_set;    /* block signals while manipulating the temp files list */    sigprocmask( SIG_BLOCK, &signal_mask, &old_set );#endif    fd = mkstemps( tmp, strlen(suffix) );    if (fd == -1)    {        /* could not create it in current directory, try in /tmp */        free(tmp);        tmp = strmake("/tmp/%s-XXXXXX%s", prefix, suffix);        fd = mkstemps( tmp, strlen(suffix) );        if (fd == -1) error( "could not create temp file/n" );    }    close( fd );    strarray_add(tmp_files, tmp);#ifdef HAVE_SIGPROCMASK    sigprocmask( SIG_SETMASK, &old_set, NULL );#endif    return tmp;}
开发者ID:WASSUM,项目名称:longene_travel,代码行数:26,


示例3: my_getwd

int my_getwd(char * buf, size_t size, myf MyFlags){  char * pos;  DBUG_ENTER("my_getwd");  DBUG_PRINT("my",("buf: 0x%lx  size: %u  MyFlags %d",                   (long) buf, (uint) size, MyFlags));  if (size < 1)    DBUG_RETURN(-1);  if (curr_dir[0])				/* Current pos is saved here */    (void) strmake(buf,&curr_dir[0],size-1);  else  {    if (size < 2)      DBUG_RETURN(-1);    if (!getcwd(buf,(uint) (size-2)) && MyFlags & MY_WME)    {      char errbuf[MYSYS_STRERROR_SIZE];      my_errno=errno;      my_error(EE_GETWD, MYF(ME_BELL+ME_WAITTANG),               errno, my_strerror(errbuf, sizeof(errbuf), errno));      DBUG_RETURN(-1);    }    if (*((pos=strend(buf))-1) != FN_LIBCHAR)  /* End with FN_LIBCHAR */    {      pos[0]= FN_LIBCHAR;      pos[1]=0;    }    (void) strmake(&curr_dir[0],buf, (size_t) (FN_REFLEN-1));  }  DBUG_RETURN(0);} /* my_getwd */
开发者ID:CSI3304Project,项目名称:CSI3304Project1,代码行数:33,


示例4: send_change_user_packet

static int send_change_user_packet(MCPVIO_EXT *mpvio,                                   const uchar *data, int data_len){    MYSQL *mysql= mpvio->mysql;    char *buff, *end;    int res= 1;    size_t conn_attr_len= (mysql->options.extension) ?                          mysql->options.extension->connect_attrs_len : 0;    buff= my_alloca(USERNAME_LENGTH+1 + data_len+1 + NAME_LEN+1 + 2 + NAME_LEN+1 + 9 + conn_attr_len);    end= strmake(buff, mysql->user, USERNAME_LENGTH) + 1;    if (!data_len)        *end++= 0;    else    {        if (mysql->client_flag & CLIENT_SECURE_CONNECTION)        {            DBUG_ASSERT(data_len <= 255);            if (data_len > 255)            {                my_set_error(mysql, CR_MALFORMED_PACKET, SQLSTATE_UNKNOWN, 0);                goto error;            }            *end++= data_len;        }        else        {            DBUG_ASSERT(data_len == SCRAMBLE_LENGTH_323 + 1);            DBUG_ASSERT(data[SCRAMBLE_LENGTH_323] == 0);        }        memcpy(end, data, data_len);        end+= data_len;    }    end= strmake(end, mpvio->db ? mpvio->db : "", NAME_LEN) + 1;    if (mysql->server_capabilities & CLIENT_PROTOCOL_41)    {        int2store(end, (ushort) mysql->charset->nr);        end+= 2;    }    if (mysql->server_capabilities & CLIENT_PLUGIN_AUTH)        end= strmake(end, mpvio->plugin->name, NAME_LEN) + 1;    end= ma_send_connect_attr(mysql, end);    res= simple_command(mysql, MYSQL_COM_CHANGE_USER,                        buff, (ulong)(end-buff), 1, NULL);error:    my_afree(buff);    return res;}
开发者ID:MarianMMX,项目名称:MarianMMX,代码行数:55,


示例5: strarray_tostring

char* strarray_tostring(const strarray* arr, const char* sep){    char *str, *newstr;    unsigned int i;    str = strmake("%s", arr->base[0]);    for (i = 1; i < arr->size; i++)    {	newstr = strmake("%s%s%s", str, sep, arr->base[i]);	free(str);	str = newstr;    }    return str;}
开发者ID:AlexSteel,项目名称:wine,代码行数:15,


示例6: symdirget

void 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,


示例7: symdirget

void 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: my_realpath

int my_realpath(char *to, const char *filename, myf MyFlags){#if defined(HAVE_REALPATH) && !defined(HAVE_purify) && !defined(HAVE_BROKEN_REALPATH)  int result=0;  char buff[BUFF_LEN];  struct stat stat_buff;  DBUG_ENTER("my_realpath");  if (!(MyFlags & MY_RESOLVE_LINK) ||      (!lstat(filename,&stat_buff) && S_ISLNK(stat_buff.st_mode)))  {    char *ptr;    if ((ptr=realpath(filename,buff)))      strmake(to,ptr,FN_REFLEN-1);    else    {      /* Realpath didn't work;  Use original name */      my_errno=errno;      if (MyFlags & MY_WME)	my_error(EE_REALPATH, MYF(0), filename, my_errno);      if (to != filename)	strmov(to,filename);      result= -1;    }  }  DBUG_RETURN(result);#else  if (to != filename)    strmov(to,filename);  return 0;#endif}
开发者ID:dparnell,项目名称:MariaDB,代码行数:32,


示例9: strmake

/* check if there is a static lib associated to a given dll */static char *find_static_lib( const char *dll ){    char *lib = strmake("%s.a", dll);    if (get_file_type(lib) == file_arh) return lib;    free( lib );    return NULL;}
开发者ID:WASSUM,项目名称:longene_travel,代码行数:8,


示例10: my_setwd

int my_setwd(const char *dir, myf MyFlags){  int res;  size_t length;  char *start, *pos;  DBUG_ENTER("my_setwd");  DBUG_PRINT("my",("dir: '%s'  MyFlags %lu", dir, MyFlags));  start=(char *) dir;  if (! dir[0] || (dir[0] == FN_LIBCHAR && dir[1] == 0))    dir=FN_ROOTDIR;  if ((res=chdir((char*) dir)) != 0)  {    my_errno=errno;    if (MyFlags & MY_WME)      my_error(EE_SETWD,MYF(ME_BELL+ME_WAITTANG),start,errno);  }  else  {    if (test_if_hard_path(start))    {						/* Hard pathname */      pos= strmake(&curr_dir[0],start,(size_t) FN_REFLEN-1);      if (pos[-1] != FN_LIBCHAR)      {	length=(uint) (pos-(char*) curr_dir);	curr_dir[length]=FN_LIBCHAR;		/* must end with '/' */	curr_dir[length+1]='/0';      }    }    else      curr_dir[0]='/0';				/* Don't save name */  }  DBUG_RETURN(res);} /* my_setwd */
开发者ID:DiegoCardona,项目名称:DontCrashMyDrone,代码行数:34,


示例11: extract_test

/* Fills in the name and exename fields */static voidextract_test (struct wine_test *test, const char *dir, int id){    BYTE* code;    DWORD size;    FILE* fout;    int strlen, bufflen = 128;    char *exepos;    code = extract_rcdata (id, TESTRES, &size);    if (!code) report (R_FATAL, "Can't find test resource %d: %d",                       id, GetLastError ());    test->name = xmalloc (bufflen);    while ((strlen = LoadStringA (NULL, id, test->name, bufflen))           == bufflen - 1) {        bufflen *= 2;        test->name = xrealloc (test->name, bufflen);    }    if (!strlen) report (R_FATAL, "Can't read name of test %d.", id);    test->exename = strmake (NULL, "%s/%s", dir, test->name);    exepos = strstr (test->name, "_test.exe");    if (!exepos) report (R_FATAL, "Not an .exe file: %s", test->name);    *exepos = 0;    test->name = xrealloc (test->name, exepos - test->name + 1);    report (R_STEP, "Extracting: %s", test->name);    if (!(fout = fopen (test->exename, "wb")) ||        (fwrite (code, size, 1, fout) != 1) ||        fclose (fout)) report (R_FATAL, "Failed to write file %s.",                               test->exename);}
开发者ID:howard5888,项目名称:wineT,代码行数:32,


示例12: These

char *my_strerror(char *buf, size_t len, int nr){  char *msg= NULL;  buf[0]= '/0';                                  /* failsafe */  /*    These (handler-) error messages are shared by perror, as required    by the principle of least surprise.  */  if ((nr >= HA_ERR_FIRST) && (nr <= HA_ERR_LAST))    msg= (char *) handler_error_messages[nr - HA_ERR_FIRST];  if (msg != NULL)    strmake(buf, msg, len - 1);  else  {    /*      On Windows, do things the Windows way. On a system that supports both      the GNU and the XSI variant, use whichever was configured (GNU); if      this choice is not advertised, use the default (POSIX/XSI).  Testing      for __GNUC__ is not sufficient to determine whether this choice exists.    */#if defined(__WIN__)    strerror_s(buf, len, nr);#elif ((defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE >= 200112L)) ||    /       (defined _XOPEN_SOURCE   && (_XOPEN_SOURCE >= 600)))      &&    /      ! defined _GNU_SOURCE    strerror_r(nr, buf, len);             /* I can build with or without GNU */#elif defined _GNU_SOURCE    char *r= strerror_r(nr, buf, len);    if (r != buf)                         /* Want to help, GNU? */      strmake(buf, r, len - 1);           /* Then don't. */#else    strerror_r(nr, buf, len);#endif  }  /*    strerror() return values are implementation-dependent, so let's    be pragmatic.  */  if (!buf[0])    strmake(buf, "unknown error", len - 1);  return buf;}
开发者ID:hobbytp,项目名称:percona-xtrabackup,代码行数:47,


示例13: my_getwd

int my_getwd(my_string buf, uint size, myf MyFlags){  my_string pos;  DBUG_ENTER("my_getwd");  DBUG_PRINT("my",("buf: 0x%lx  size: %d  MyFlags %d", buf,size,MyFlags));#if ! defined(MSDOS)  if (curr_dir[0])				/* Current pos is saved here */    VOID(strmake(buf,&curr_dir[0],size-1));  else#endif  {#if defined(HAVE_GETCWD)    if (!getcwd(buf,size-2) && MyFlags & MY_WME)    {      my_errno=errno;      my_error(EE_GETWD,MYF(ME_BELL+ME_WAITTANG),errno);      return(-1);    }#elif defined(HAVE_GETWD)    {      char pathname[MAXPATHLEN];      getwd(pathname);      strmake(buf,pathname,size-1);    }#elif defined(VMS)    if (!getcwd(buf,size-2,1) && MyFlags & MY_WME)    {      my_errno=errno;      my_error(EE_GETWD,MYF(ME_BELL+ME_WAITTANG),errno);      return(-1);    }    intern_filename(buf,buf);#else#error "No way to get current directory"#endif    if (*((pos=strend(buf))-1) != FN_LIBCHAR)  /* End with FN_LIBCHAR */    {      pos[0]= FN_LIBCHAR;      pos[1]=0;    }    (void) strmake(&curr_dir[0],buf,(size_s) (FN_REFLEN-1));  }  DBUG_RETURN(0);} /* my_getwd */
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:45,


示例14: fs_character_set

char *convert_dirname(char *to, const char *from, const char *from_end){  char *to_org=to;#ifdef BACKSLASH_MBTAIL  CHARSET_INFO *fs= fs_character_set();#endif  /* We use -2 here, becasue we need place for the last FN_LIBCHAR */  if (!from_end || (from_end - from) > FN_REFLEN-2)    from_end=from+FN_REFLEN -2;#if FN_LIBCHAR != '/' || defined(FN_C_BEFORE_DIR_2)  {    for (; from != from_end && *from ; from++)    {      if (*from == '/')	*to++= FN_LIBCHAR;#ifdef FN_C_BEFORE_DIR_2      else if (*from == FN_C_BEFORE_DIR_2)	*to++= FN_C_BEFORE_DIR;      else if (*from == FN_C_AFTER_DIR_2)	*to++= FN_C_AFTER_DIR;#endif      else      {#ifdef BACKSLASH_MBTAIL        uint l;        if (use_mb(fs) && (l= my_ismbchar(fs, from, from + 3)))        {          memmove(to, from, l);          to+= l;          from+= l - 1;          to_org= to; /* Don't look inside mbchar */        }        else#endif        {          *to++= *from;        }      }    }    *to=0;  }#else  /* This is ok even if to == from, becasue we need to cut the string */  to= strmake(to, from, (uint) (from_end-from));#endif  /* Add FN_LIBCHAR to the end of directory path */  if (to != to_org && (to[-1] != FN_LIBCHAR && to[-1] != FN_DEVCHAR))  {    *to++=FN_LIBCHAR;    *to=0;  }  return to;					/* Pointer to end of dir */} /* convert_dirname */
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:56,


示例15: parse_spec_export

/******************************************************************* *         parse_spec_export * * Parse an exported function definition in a .spec file. */static int parse_spec_export( ORDDEF *odp, DLLSPEC *spec ){    const char *token;    int is_win32 = (spec->type == SPEC_WIN32) || (odp->flags & FLAG_EXPORT32);    if (!is_win32 && odp->type == TYPE_STDCALL)    {        error( "'stdcall' not supported for Win16/n" );        return 0;    }    if (!is_win32 && odp->type == TYPE_THISCALL)    {        error( "'thiscall' not supported for Win16/n" );        return 0;    }    if (is_win32 && odp->type == TYPE_PASCAL)    {        error( "'pascal' not supported for Win32/n" );        return 0;    }    if (!parse_spec_arguments( odp, spec, 0 )) return 0;    if (odp->type == TYPE_VARARGS)        odp->flags |= FLAG_NORELAY;  /* no relay debug possible for varags entry point */    if (!(token = GetToken(1)))    {        if (!strcmp( odp->name, "@" ))        {            error( "Missing handler name for anonymous function/n" );            return 0;        }        odp->link_name = xstrdup( odp->name );    }    else    {        odp->link_name = xstrdup( token );        if (strchr( odp->link_name, '.' ))        {            if (!is_win32)            {                error( "Forwarded functions not supported for Win16/n" );                return 0;            }            odp->flags |= FLAG_FORWARD;        }    }    if (target_cpu == CPU_x86 && odp->type == TYPE_THISCALL && !(odp->flags & FLAG_FORWARD))    {        char *link_name = strmake( "__thiscall_%s", odp->link_name );        free( odp->link_name );        odp->link_name = link_name;    }    return 1;}
开发者ID:Sunmonds,项目名称:wine,代码行数:61,


示例16: my_getwd

int my_getwd(char * buf, size_t size, myf MyFlags){  char * pos;  DBUG_ENTER("my_getwd");  DBUG_PRINT("my",("buf: 0x%lx  size: %u  MyFlags %lu",                   (long) buf, (uint) size, MyFlags));  if (size < 1)    DBUG_RETURN(-1);  if (curr_dir[0])				/* Current pos is saved here */    (void) strmake(buf,&curr_dir[0],size-1);  else  {#if defined(HAVE_GETCWD)    if (size < 2)      DBUG_RETURN(-1);    if (!getcwd(buf,(uint) (size-2)) && MyFlags & MY_WME)    {      my_errno=errno;      my_error(EE_GETWD,MYF(ME_BELL+ME_WAITTANG),errno);      DBUG_RETURN(-1);    }#elif defined(HAVE_GETWD)    {      char pathname[MAXPATHLEN];      getwd(pathname);      strmake(buf,pathname,size-1);    }#else#error "No way to get current directory"#endif    if (*((pos=strend(buf))-1) != FN_LIBCHAR)  /* End with FN_LIBCHAR */    {      pos[0]= FN_LIBCHAR;      pos[1]=0;    }    (void) strmake(&curr_dir[0],buf, (size_t) (FN_REFLEN-1));  }  DBUG_RETURN(0);} /* my_getwd */
开发者ID:DiegoCardona,项目名称:DontCrashMyDrone,代码行数:41,


示例17: segment_read

/** * Read a tag segment with sorting. * *	@param[in]	gtop	#GTOP structure <br> *		Output:	@CODE{gtop->gtp_array}		segment table <br> *		Output:	@CODE{gtop->gtp_count}		segment table size <br> *		Output:	@CODE{gtop->gtp_index}		segment table index (initial value = 0) <br> *		Output:	@CODE{gtop->cur_tagname}	current tag name * * A segment is a set of tag records which have same tag name. <br> * This function read a segment from tag file, sort it and put it on segment table. <br> * This function can treat both of standard format and compact format. * * Sorting is done by three keys. *	- 1st key: tag name *	- 2nd key: file name *	- 3rd key: line number * * Since all records in a segment have same tag name, you need not think about 1st key. */voidsegment_read(GTOP *gtop){	const char *tagline, *fid, *path, *lineno;	GTP *gtp;	struct sh_entry *sh;	/*	 * Save tag lines.	 */	gtop->cur_tagname[0] = '/0';	while ((tagline = dbop_next(gtop->dbop)) != NULL) {		VIRTUAL_GRTAGS_GSYMS_PROCESSING(gtop);		/*		 * get tag name and line number.		 *		 * tagline = <file id> <tag name> <line number>		 */		if (gtop->cur_tagname[0] == '/0') {			strlimcpy(gtop->cur_tagname, gtop->dbop->lastkey, sizeof(gtop->cur_tagname));		} else if (strcmp(gtop->cur_tagname, gtop->dbop->lastkey) != 0) {			/*			 * Dbop_next() wil read the same record again.			 */			dbop_unread(gtop->dbop);			break;		}		gtp = varray_append(gtop->vb);		gtp->tagline = pool_strdup(gtop->segment_pool, tagline, 0);		gtp->tag = (const char *)gtop->cur_tagname;		/*		 * convert fid into hashed path name to save memory.		 */		fid = (const char *)strmake(tagline, " ");		path = gpath_fid2path(fid, NULL);		if (path == NULL)			die("gtags_first: path not found. (fid=%s)", fid);		sh = strhash_assign(gtop->path_hash, path, 1);		gtp->path = sh->name;		lineno = seekto(gtp->tagline, SEEKTO_LINENO);		if (lineno == NULL)			die("illegal tag record./n%s", tagline);		gtp->lineno = atoi(lineno);	}	/*	 * Sort tag lines.	 */	gtop->gtp_array = varray_assign(gtop->vb, 0, 0);	gtop->gtp_count = gtop->vb->length;	gtop->gtp_index = 0;	if (!(gtop->flags & GTOP_NOSORT))		qsort(gtop->gtp_array, gtop->gtp_count, sizeof(GTP), compare_tags);}
开发者ID:lshain,项目名称:enviroment,代码行数:73,


示例18: my_thread_dbug_id

const char *my_thread_name(void){  char name_buff[100];  struct st_my_thread_var *tmp=my_thread_var;  if (!tmp->name[0])  {    my_thread_id id= my_thread_dbug_id();    sprintf(name_buff,"[email
C++ strmhz函数代码示例
C++ strm函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。