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

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

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

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

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

示例1: fprintf

isotopes_t *load_isotope_table(char *filename) {    char *line, *line_split;    char *columns[6];    char **col;    char *name=calloc(MAX_ELEMENT_NAME,sizeof(char));    FILE *in_file=fopen(filename, "r");    if(!in_file) {        fprintf(stderr, "Could not load isotope table from file %s/n", filename);        return NULL;    }    line=malloc(sizeof(char)*MASSES_LINE_LENGTH);    if(!line)         return NULL;    isotopes_t *isotopes=malloc(sizeof(isotopes_t));    if(!isotopes)        return NULL;    isotopes->n_isotopes=0;    isotopes->i = malloc(sizeof(isotope_t)*MASSES_MAX_ISOTOPES);    if(!isotopes->i)        return NULL;    while(fgets(line, MASSES_LINE_LENGTH, in_file) != NULL) {        line_split=line; /* strsep will screw up line_split, reset for every new line */        for (col = columns; (*col = strsep(&line_split, " /t")) != NULL;)            if (**col != '/0')                if (++col >= &columns[6])                    break;        snprintf(name, MAX_ELEMENT_NAME, "%i-%s", (int)strtol(columns[2], NULL, 10), columns[3]);        add_isotope_to_table(isotopes, strtoimax(columns[1], NULL, 10), strtoimax(columns[0], NULL, 10), strtoimax(columns[2], NULL, 10), name, strtod(columns[4], NULL)/1e6, strtod(columns[5], NULL)/1e2);    }    fclose(in_file);    return isotopes;}
开发者ID:Caffeinomane,项目名称:potku,代码行数:32,


示例2: slow_get_thread_bounds

static voidslow_get_thread_bounds (guint8 *current, guint8 **staddr, size_t *stsize){	char buff [1024];	FILE *f = fopen ("/proc/self/maps", "r");	if (!f)		g_error ("Could not determine thread bounds, failed to open /proc/self/maps");	while (fgets (buff, sizeof (buff), f)) {		intmax_t low, high;		char *ptr = buff;		char *end = NULL;		//each line starts with the range we want: f7648000-f7709000		low = strtoimax (ptr, &end, 16);		if (end) {			ptr = end + 1; //skip the dash to make sure we don't get a negative number			end = NULL;			high = strtoimax (ptr, &end, 16);		}		if (end && low <= (intmax_t)(size_t)current && high > (intmax_t)(size_t)current) {			*staddr = (guint8 *)(size_t)low;			*stsize = (size_t)(high - low);			fclose (f);			return;		}	}	g_error ("Could not determine thread bounds, failed to find current stack pointer in /proc/self/maps");}
开发者ID:0ostreamo0,项目名称:mono,代码行数:28,


示例3: parse_range

/* * Parse a range specification */static intparse_range(const char *spec, struct range *range){	const char *delim;	char *end;	/* @ means invert the range */	if (*spec == '@') {		++spec;		range->inverted = 1;	} else {		range->inverted = 0;	}	/* empty spec... */	if (*spec == '/0')		return (-1);	if ((delim = strchr(spec, ':')) != NULL) {		/*		 * The Nagios plugin documentation says nothing about how		 * to interpret ":N", so we disallow it.  Allowed forms		 * are "~:N", "~:", "M:" and "M:N".		 */		if (delim - spec == 1 && *spec == '~') {			range->lo = INTMAX_MIN;		} else {			range->lo = strtoimax(spec, &end, 10);			if (end != delim)				return (-1);		}		if (*(delim + 1) != '/0') {			range->hi = strtoimax(delim + 1, &end, 10);			if (*end != '/0')				return (-1);		} else {			range->hi = INTMAX_MAX;		}	} else {		/*		 * Allowed forms are N		 */		range->lo = 0;		range->hi = strtol(spec, &end, 10);		if (*end != '/0')			return (-1);	}	/*	 * Sanity	 */	if (range->lo > range->hi)		return (-1);	range->defined = 1;	return (0);}
开发者ID:bzed,项目名称:pkg-nagios-plugins-contrib,代码行数:60,


示例4: TEST

TEST(inttypes, strtoimax_EINVAL) {  errno = 0;  strtoimax("123", NULL, -1);  ASSERT_EQ(EINVAL, errno);  errno = 0;  strtoimax("123", NULL, 1);  ASSERT_EQ(EINVAL, errno);  errno = 0;  strtoimax("123", NULL, 37);  ASSERT_EQ(EINVAL, errno);}
开发者ID:0xDEC0DE8,项目名称:platform_bionic,代码行数:11,


示例5: parseIt

char * parseIt(char * text){    char * target;    if (!strstr(text, "//x"))    {        target = strdup(text);        return target;    }    char * hex = "0123456789abcdef";    target = malloc(strlen(text) + 1);    char * start = text;    char * end = text;    while (end = strstr(start, "//x"))    {        unsigned char text[3] = {0};        unsigned char value[2] = {0};        strncat(target, start, end - start);        text[0] = end[2];        text[1] = end[3];        value[0] =  strtoimax(text, NULL, 10);        strcat(target, value);//        strncat(target, start, end - start);        start = end + 4;    }    strcat(target, start);    return target;}
开发者ID:mdaughtrey,项目名称:personal-projects,代码行数:31,


示例6: if

bool Nibbler::getInt (int& result){  auto i = _cursor;  if (i < _length)  {    if ((*_input)[i] == '-')      ++i;    else if ((*_input)[i] == '+')      ++i;  }  // TODO Potential for use of find_first_not_of  while (i < _length && Lexer::isDigit ((*_input)[i]))    ++i;  if (i > _cursor)  {    result = strtoimax (_input->substr (_cursor, i - _cursor).c_str (), NULL, 10);    _cursor = i;    return true;  }  return false;}
开发者ID:austinwagner,项目名称:task,代码行数:25,


示例7: processArguments

int processArguments(int argc, char* argv[]) {int i;u_int temp;for(i=1; i<argc; i++) {if(strcmp(argv[i],"-h")==0) {printHelp(argv[0],false);return true;}if(strcmp(argv[i],"-p")==0) {temp = strtoimax(argv[++i], NULL, 10);if(temp == 0 || temp < MINPORT || temp > MAXPORT) {printHelp(argv[0],true,"Port out of range/n");return false;}port = temp;} else if(strcmp(argv[i],"-d")==0) {strncpy(baseDir,argv[++i],254);} else if(strstr(argv[i],"-v")!=NULL) {debugLevel = strlen(argv[i])-1;} else {printHelp(argv[0],true,"Unkown option/n");return false;}}debug(2,"%s","Configuraciones:");debug(2,"Puerto:/t/t%u",port);debug(2,"Base Directory:/t%s",baseDir);return true;}
开发者ID:SaritaMontesdeOca,项目名称:Actividad1_Sockets,代码行数:34,


示例8: if

bool Nibbler::getHex (int& result){  std::string::size_type i = mCursor;  if (i < mLength)  {    if (mInput[i] == '-')      ++i;    else if (mInput[i] == '+')      ++i;  }  // TODO Potential for use of find_first_not_of  while (i < mLength && isxdigit (mInput[i]))    ++i;  if (i > mCursor)  {    result = strtoimax (mInput.substr (mCursor, i - mCursor).c_str (), NULL, 16);    mCursor = i;    return true;  }  return false;}
开发者ID:lmacken,项目名称:task,代码行数:25,


示例9: strtoimax

const int Config::getInteger (const std::string& key){  if ((*this).find (key) != (*this).end ())    return strtoimax ((*this)[key].c_str (), NULL, 10);  return 0;}
开发者ID:nigeil,项目名称:task,代码行数:7,


示例10: l_filter_reject_code

static intl_filter_reject_code(lua_State *L){	uint64_t	id;	const char	*s_id;	uint32_t	action;	uint32_t	code;	const char	*line;	if (lua_gettop(L) != 4)		return (0);	s_id = luaL_checklstring(L, 1, NULL);	id = strtoimax(s_id, (char **)NULL, 10);	action = luaL_checkinteger(L, 2);	code = luaL_checkinteger(L, 3);	line = luaL_checklstring(L, 4, NULL);	switch (action) {	case FILTER_FAIL:	case FILTER_CLOSE:		filter_api_reject_code(id, action, code, line);		break;	}	return (0);}
开发者ID:gretel,项目名称:OpenSMTPD,代码行数:27,


示例11: main

int main(int args, char* arg_v[]){  if (args != 2) {    printf("Usage: ./CLRS index_of_fibonacci/n");    return 0;  }  char *endptr;  int index = strtoimax(arg_v[1], &endptr, 10);  if (*endptr != '/0') {    printf("Usage: ./CLRS index_of_fibonacci/n/n");    printf("       index_of_fibonacci need to be a number.[%s]/n", endptr);    return 0;  }#if defined(__LP64__) || defined(_WIN64)  // LP64 machine, OS X or Linux  if (index > 93) {    printf("ERROR: fib(%d) is larger than UINT64_MAX /n", index);    return 0;  }#else  // 32-bit machine, Windows or Linux or OS X  if (index > 47) {    printf("ERROR: fib(%d) is larger than UINT32_MAX /n", index);    return 0;  }#endif  doFibonacci_matrix(index);  return 0;}
开发者ID:TonnyXu,项目名称:Algorithms-iOS,代码行数:31,


示例12: sysfs_value_read

int64_t sysfs_value_read(char *path){	char buffer[100];	int64_t value;	int fd = -1;	int rc;	if (path == NULL)		return -1;	fd = open(path, O_RDONLY);	if (fd < 0)		goto error;	rc = read(fd, &buffer, sizeof(buffer));	if (rc <= 0)		goto error;	value = (int64_t)strtoimax(buffer, NULL, 10);	goto complete;error:	value = -1;complete:	if (fd >= 0)		close(fd);	return value;}
开发者ID:SdtBarbarossa,项目名称:twrp_i9300,代码行数:30,


示例13: read_negative_num

static voidread_negative_num (FILE *fp, intmax_t min_val, intmax_t *pval){  int c;  size_t i;  char buf[INT_BUFSIZE_BOUND (intmax_t)];  char *ep;  buf[0] = '-';  for (i = 1; ISDIGIT (c = getc (fp)); i++)    {      if (i == sizeof buf - 1)	FATAL_ERROR ((0, 0, _("Field too long while reading snapshot file")));      buf[i] = c;    }  if (c < 0)    {      if (ferror (fp))	FATAL_ERROR ((0, errno, _("Read error in snapshot file")));      else	FATAL_ERROR ((0, 0, _("Unexpected EOF in snapshot file")));    }  buf[i] = 0;  errno = 0;  *pval = strtoimax (buf, &ep, 10);  if (c || errno || *pval < min_val)    FATAL_ERROR ((0, errno, _("Unexpected field value in snapshot file")));}
开发者ID:jelaas,项目名称:bifrost-build,代码行数:30,


示例14: decompose_filename

static booldecompose_filename(const char *filename, struct partqueue *pq){  const char *p;  char *q;  if (strspn(filename, "0123456789abcdef") != MD5HASHLEN ||      filename[MD5HASHLEN] != '.')    return false;  q = nfmalloc(MD5HASHLEN + 1);  memcpy(q, filename, MD5HASHLEN);  q[MD5HASHLEN] = '/0';  pq->info.md5sum= q;  p = filename + MD5HASHLEN + 1;  pq->info.maxpartlen = strtoimax(p, &q, 16);  if (q == p || *q++ != '.')    return false;  p = q;  pq->info.thispartn = (int)strtol(p, &q, 16);  if (q == p || *q++ != '.')    return false;  p = q;  pq->info.maxpartn = (int)strtol(p, &q, 16);  if (q == p || *q)    return false;  return true;}
开发者ID:samdunne,项目名称:dpkg-diversions,代码行数:27,


示例15: parse_simple

int parse_simple(char *start, char *end, Atom *result){	char *p;	int value = strtoimax(start, &p, 10);	/*it is integer*/	if(p == end) {		result->type = ATOM_INTEGER;		result->value.integer = value;		//return true;		return ERROR_OK;	}	/*nil or symbol*/	char *buf = malloc(end - start + 1);	p = buf;	while(start != end) {		*p++= *start++;	}	*p = '/0';	/*convert to uppercase*/	convertToUpperCase(buf);	if(strcmp(buf, "NIL") == 0)		*result = nil;	else		*result = make_symbol(buf);	free(buf);	return ERROR_OK;}
开发者ID:liuyongvs,项目名称:lisp-interpreter,代码行数:29,


示例16: atomax

/* * Convert a string into an integer of type intmax_t.  Alow trailing spaces. */intmax_t atomax(const char *s, int base){	char *p;	intmax_t r;	errno = 0;	r = strtoimax(s, &p, base);	if (errno != 0)		badnum(s);	/*	 * Disallow completely blank strings in non-arithmetic (base != 0)	 * contexts.	 */	if (p == s && base)		badnum(s);	while (isspace((unsigned char)*p))	      p++;	if (*p)		badnum(s);	return r;}
开发者ID:spk121,项目名称:dash,代码行数:29,


示例17: r_init_confval

/** * Get the specified numerical config value, subject to limits. */intmax_tr_init_confval(struct ndnr_handle *h, const char *key,                     intmax_t lo, intmax_t hi, intmax_t deflt) {    const char *s;    intmax_t v;    char *ep;        if (!(lo <= deflt && deflt <= hi))        abort();    s = getenv(key);    if (s != NULL && s[0] != 0) {        ep = "x";        v = strtoimax(s, &ep, 10);        if (v != 0 || ep[0] == 0) {            if (v > hi)                v = hi;            if (v < lo)                v = lo;            if (NDNSHOULDLOG(h, mmm, NDNL_FINEST))                ndnr_msg(h, "Using %s=%jd", key, v);            return(v);        }    }    return (deflt);}
开发者ID:cawka,项目名称:packaging-ndnx,代码行数:28,


示例18: strtosysint

intmax_tstrtosysint (char const *arg, char **arglim, intmax_t minval, uintmax_t maxval){  errno = 0;  if (maxval <= INTMAX_MAX)    {      if (ISDIGIT (arg[*arg == '-']))	{	  intmax_t i = strtoimax (arg, arglim, 10);	  intmax_t imaxval = maxval;	  if (minval <= i && i <= imaxval)	    return i;	  errno = ERANGE;	  return i < minval ? minval : maxval;	}    }  else    {      if (ISDIGIT (*arg))	{	  uintmax_t i = strtoumax (arg, arglim, 10);	  if (i <= maxval)	    return represent_uintmax (i);	  errno = ERANGE;	  return maxval;	}    }  errno = EINVAL;  return 0;}
开发者ID:Happuri,项目名称:various,代码行数:31,


示例19: get_arg

intmax_t get_arg(char *argv[], int pos){	intmax_t val = strtoimax(argv[pos], NULL, 10);	if (errno == EINVAL || errno == ERANGE)  {		usage(argv, pos);	}	return val;}
开发者ID:arthepsy,项目名称:xrandom,代码行数:8,


示例20: main

intmain(int argc, char *argv[]){	int ch;	FILE *fp;	int first, linecnt = -1, eval = 0;	off_t bytecnt = -1;	char *ep;	obsolete(argv);	while ((ch = getopt(argc, argv, "n:c:")) != -1)		switch(ch) {		case 'c':			bytecnt = strtoimax(optarg, &ep, 10);			if (*ep || bytecnt <= 0)				errx(1, "illegal byte count -- %s", optarg);			break;		case 'n':			linecnt = strtol(optarg, &ep, 10);			if (*ep || linecnt <= 0)				errx(1, "illegal line count -- %s", optarg);			break;		case '?':		default:			usage();		}	argc -= optind;	argv += optind;	if (linecnt != -1 && bytecnt != -1)		errx(1, "can't combine line and byte counts");	if (linecnt == -1 )		linecnt = 10;	if (*argv) {		for (first = 1; *argv; ++argv) {			if ((fp = fopen(*argv, "r")) == NULL) {				warn("%s", *argv);				eval = 1;				continue;			}			if (argc > 1) {				(void)printf("%s==> %s <==/n",				    first ? "" : "/n", *argv);				first = 0;			}			if (bytecnt == -1)				head(fp, linecnt);			else				head_bytes(fp, bytecnt);			(void)fclose(fp);		}	} else if (bytecnt == -1)		head(stdin, linecnt);	else		head_bytes(stdin, bytecnt);	exit(eval);}
开发者ID:coyizumi,项目名称:cs111,代码行数:58,


示例21: _xml_end_cb

static void_xml_end_cb(void *data, const char *el){	XML_Parser p;	p = data;	if (!strcmp(el, "ic")) {		if (_cur_ic == NULL)			errx(1, "bogus IC end tag at line %jd",			    (intmax_t) XML_GetCurrentLineNumber(p));		STAILQ_INSERT_TAIL(&_iclist, _cur_ic, next);		_cur_ic = NULL;	} else if (!strcmp(el, "tp")) {		if (_cur_tp == NULL)			errx(1, "bogus TP end tag at line %jd",			    (intmax_t) XML_GetCurrentLineNumber(p));		assert(_cur_ic != NULL);		_test_cnt++;		_cur_tp->testnum = _test_cnt;		STAILQ_INSERT_TAIL(&_cur_ic->tplist, _cur_tp, next);		_cur_ic->tpcnt++;		_cur_tp = NULL;	} else if (!strcmp(el, "vc")) {		if (_cur_vc == NULL)			errx(1, "bogus VC end tag at line %jd",			    (intmax_t) XML_GetCurrentLineNumber(p));		if (_xml_data_pos == 0 && _cur_vc->vt != _VTYPE_STRING)			errx(1, "VC element without value defined at line %jd",			    (intmax_t) XML_GetCurrentLineNumber(p));		_xml_data[_xml_data_pos] = '/0';		switch (_cur_vc->vt) {		case _VTYPE_INT:			_cur_vc->v.i64 = strtoimax(_xml_data, NULL, 0);			break;		case _VTYPE_UINT:			_cur_vc->v.u64 = strtoumax(_xml_data, NULL, 0);			break;		case _VTYPE_STRING:			_cur_vc->v.str = strdup(_xml_data);			if (_cur_vc->v.str == NULL)				err(1, "strdup");			break;		case _VTYPE_BLOCK:			driver_base64_decode(_xml_data, _xml_data_pos,			    &_cur_vc->v.b.data, &_cur_vc->v.b.len);			break;		default:			assert(0);			break;		}		_xml_data_pos = 0;		assert(_cur_tp != NULL);		STAILQ_INSERT_TAIL(&_cur_tp->vclist, _cur_vc, next);		_cur_vc = NULL;	}}
开发者ID:elftoolchain,项目名称:elftoolchain,代码行数:58,


示例22: processArguments

int processArguments(int argc, char* argv[]) {	int i;	u_int temp;		if(argc < 3) {		printHelp(argv[0],true,"Faltan Argumentos/n");		return false;	}	    if(strcmp(argv[1],"-r")==0){		mode = SERVER;	} else if(strcmp(argv[1],"-t")==0) {		mode = CLIENT;	} else {		printHelp(argv[0],true,"Unkown Mode/n");		return false;	}		for(i=2; i<(argc-1); i++) {		if(strcmp(argv[i],"-h")==0) {			printHelp(argv[0],false);			return true;		}					if(strcmp(argv[i],"-p")==0) {			temp = strtoimax(argv[++i], NULL, 10);			if(temp == 0 || temp < MINPORT || temp > MAXPORT) {				printHelp(argv[0],true,"Port out of range/n");				return false;			}			port = temp;		} else if(strcmp(argv[i],"-d")==0) {			stpncpy(ip_dst,argv[++i],18);		} else if(strstr(argv[i],"-v")!=NULL) {			debugLevel = strlen(argv[i])-1;		} else if(strcmp(argv[i],"-i")==0) {			stpncpy(ip_listen,argv[++i],18);			} else {			printHelp(argv[0],true,"Unkown option/n");			return false;		}		}		stpncpy(filename,argv[i],254);	debug(2,"%s","/tConfiguraciones:");	if(mode == SERVER) {		debug(2,"/t/tModo:/t%s","Servidor");		debug(2,"/t/tListen on:/t%s:%u",ip_listen,port);	} else if (mode == CLIENT) {			debug(2,"/t/tModo:/t%s","Cliente");		debug(2,"/t/tDestino:/t%s:%u",ip_dst,port);	}	debug(2,"/t/tFileName:/t%s",filename);		return true;}
开发者ID:Jorge-Arrezola,项目名称:file_transfer,代码行数:58,


示例23: str_to_uint16

void str_to_uint16(char *str, uint16_t *res, uint8_t base) {  char *end;  errno = 0;  intmax_t val = strtoimax(str, &end, base);  if (errno == ERANGE || val < 0 || val > UINT16_MAX ||    end == str || *end != '/0')    return;  *res = (uint16_t) val;}
开发者ID:gnkarn,项目名称:IRremoteESP8266,代码行数:9,


示例24: str_to_uint16

static int str_to_uint16(const char *str, uint16_t *res) {    char *end;    errno = 0;    intmax_t val = strtoimax(str, &end, 10);    if (errno == ERANGE || val < 0 || val > UINT16_MAX || end == str || *end != '/0')        return 0;    *res = (uint16_t) val;    return 1;}
开发者ID:beoliver,项目名称:cservers,代码行数:9,


示例25: netlink_init_interfaces_list

    static int netlink_init_interfaces_list(void)    {        int ret = -1;        DIR  *netdir;        struct dirent *de;        char path[SYSFS_PATH_MAX];        interface_info_t *intfinfo;        int index;        FILE *ifidx;        #define MAX_FGETS_LEN 4        char idx[MAX_FGETS_LEN+1];        if ((netdir = opendir(SYSFS_CLASS_NET)) != NULL) {             while ((de = readdir(netdir))) {                if ((!strcmp(de->d_name, ".")) || (!strcmp(de->d_name, ".."))                    ||(!strcmp(de->d_name, "lo")) || (!strcmp(de->d_name, "wmaster0")) ||                    (!strcmp(de->d_name, "pan0")))                    continue;                snprintf(path, SYSFS_PATH_MAX,"%s/%s/phy80211", SYSFS_CLASS_NET, de->d_name);                if (!access(path, F_OK))                    continue;                snprintf(path, SYSFS_PATH_MAX,"%s/%s/wireless", SYSFS_CLASS_NET, de->d_name);                if (!access(path, F_OK))                        continue;                snprintf(path, SYSFS_PATH_MAX,"%s/%s/ifindex", SYSFS_CLASS_NET, de->d_name);                if ((ifidx = fopen(path, "r")) != NULL) {                    memset(idx, 0, MAX_FGETS_LEN+1);                    if (fgets(idx,MAX_FGETS_LEN, ifidx) != NULL) {                        index = strtoimax(idx, NULL, 10);                    } else {                        LOGE("Can not read %s", path);                        continue;                    }                } else {                    LOGE("Can not open %s for read", path);                    continue;                }                /* make some room! */                intfinfo = (interface_info_t *)malloc(sizeof(interface_info_t));                if (intfinfo == NULL) {                    LOGE("malloc in netlink_init_interfaces_table");                    goto error;                }                /* copy the interface name (eth0, eth1, ...) */                intfinfo->name = strndup((char *) de->d_name, SYSFS_PATH_MAX);                intfinfo->i = index;                LOGI("interface %s:%d found", intfinfo->name, intfinfo->i);                add_int_to_list(intfinfo);            }            closedir(netdir);        }        ret = 0;    error:        return ret;    }
开发者ID:jamesyan84,项目名称:mt36k_android_4.0.4,代码行数:57,


示例26: ini_process_short

static inline int ini_process_short(const char* curr_name, const char* value, const char* option_name, short* target, ini_value_list_type* value_names) {    if(strcasecmp(curr_name, option_name) == 0) {        if (strcasecmp(value, "default") != 0) {            int named_value = ini_get_named_value(value, value_names);            *target = (named_value == INI_NO_VALID_NAME) ? ((short) strtoimax(value, NULL, 0)) : ((short) named_value);        }        return 1; // finished; don't look for more possible options that curr_name can be    }    return 0; // not the right option; should check another option_name}
开发者ID:ecalot,项目名称:SDLPoP,代码行数:10,


示例27: main

int main(){    {    int8_t  i1 = 0;    int16_t i2 = 0;    int32_t i3 = 0;    int64_t i4 = 0;    }    {    uint8_t  i1 = 0;    uint16_t i2 = 0;    uint32_t i3 = 0;    uint64_t i4 = 0;    }    {    int_least8_t  i1 = 0;    int_least16_t i2 = 0;    int_least32_t i3 = 0;    int_least64_t i4 = 0;    }    {    uint_least8_t  i1 = 0;    uint_least16_t i2 = 0;    uint_least32_t i3 = 0;    uint_least64_t i4 = 0;    }    {    int_fast8_t  i1 = 0;    int_fast16_t i2 = 0;    int_fast32_t i3 = 0;    int_fast64_t i4 = 0;    }    {    uint_fast8_t  i1 = 0;    uint_fast16_t i2 = 0;    uint_fast32_t i3 = 0;    uint_fast64_t i4 = 0;    }    {    intptr_t  i1 = 0;    uintptr_t i2 = 0;    intmax_t  i3 = 0;    uintmax_t i4 = 0;    }    {    imaxdiv_t  i1 = {0};    }    intmax_t i = 0;    static_assert((std::is_same<decltype(imaxabs(i)), intmax_t>::value), "");    static_assert((std::is_same<decltype(imaxdiv(i, i)), imaxdiv_t>::value), "");    static_assert((std::is_same<decltype(strtoimax("", (char**)0, 0)), intmax_t>::value), "");    static_assert((std::is_same<decltype(strtoumax("", (char**)0, 0)), uintmax_t>::value), "");    static_assert((std::is_same<decltype(wcstoimax(L"", (wchar_t**)0, 0)), intmax_t>::value), "");    static_assert((std::is_same<decltype(wcstoumax(L"", (wchar_t**)0, 0)), uintmax_t>::value), "");}
开发者ID:32bitmicro,项目名称:riscv-libcxx,代码行数:55,


示例28: strtoimax

status_tIntegerValueFormatter::_ValidateSigned(const BString& input, type_code type,                                       ::Value*& _output, bool wantsValue) const{    const char* text = input.String();    char *parseEnd = NULL;    intmax_t parsedValue = strtoimax(text, &parseEnd, 10);    if (parseEnd - text < input.Length() && !isspace(*parseEnd))        return B_NO_MEMORY;    BVariant newValue;    switch (type) {    case B_INT8_TYPE:    {        if (parsedValue < INT8_MIN || parsedValue > INT8_MAX)            return B_BAD_VALUE;        newValue.SetTo((int8)parsedValue);        break;    }    case B_INT16_TYPE:    {        if (parsedValue < INT16_MIN || parsedValue > INT16_MAX)            return B_BAD_VALUE;        newValue.SetTo((int16)parsedValue);        break;    }    case B_INT32_TYPE:    {        if (parsedValue < INT32_MIN || parsedValue > INT32_MAX)            return B_BAD_VALUE;        newValue.SetTo((int32)parsedValue);        break;    }    case B_INT64_TYPE:    {        newValue.SetTo((int64)parsedValue);        break;    }    default:        return B_BAD_VALUE;    }    if (wantsValue) {        _output = new(std::nothrow) IntegerValue(newValue);        if (_output == NULL)            return B_NO_MEMORY;    }    return B_OK;}
开发者ID:kodybrown,项目名称:haiku,代码行数:53,


示例29: _strtoimax

static bool _strtoimax(const char *str, int base, intmax_t *out) {	char *endptr = NULL;	errno = 0;	intmax_t ret = strtoimax(str, &endptr, base);	if (errno != 0) return false;	if (*endptr != '/0') {		errno = EINVAL;		return false;	}	*out = ret;	return true;}
开发者ID:eatnumber1,项目名称:rehlib,代码行数:12,


示例30: expand_number

/* * Convert an expression of the following forms to a int64_t. * 	1) A positive decimal number. *	2) A positive decimal number followed by a 'b' or 'B' (mult by 1). *	3) A positive decimal number followed by a 'k' or 'K' (mult by 1 << 10). *	4) A positive decimal number followed by a 'm' or 'M' (mult by 1 << 20). *	5) A positive decimal number followed by a 'g' or 'G' (mult by 1 << 30). *	6) A positive decimal number followed by a 't' or 'T' (mult by 1 << 40). *	7) A positive decimal number followed by a 'p' or 'P' (mult by 1 << 50). *	8) A positive decimal number followed by a 'e' or 'E' (mult by 1 << 60). */intexpand_number(const char *buf, int64_t *num){	static const char unit[] = "bkmgtpe";	char *endptr, s;	int64_t number;	int i;	number = strtoimax(buf, &endptr, 0);	if (endptr == buf) {		/* No valid digits. */		errno = EINVAL;		return (-1);	}	if (*endptr == '/0') {		/* No unit. */		*num = number;		return (0);	}	s = tolower(*endptr);	switch (s) {	case 'b':	case 'k':	case 'm':	case 'g':	case 't':	case 'p':	case 'e':		break;	default:		/* Unrecognized unit. */		errno = EINVAL;		return (-1);	}	for (i = 0; unit[i] != '/0'; i++) {		if (s == unit[i])			break;		if ((number < 0 && (number << 10) > number) ||		    (number >= 0 && (number << 10) < number)) {			errno = ERANGE;			return (-1);		}		number <<= 10;	}	*num = number;	return (0);}
开发者ID:FS1360472174,项目名称:dummynet,代码行数:63,



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


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