博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Strtoul command
阅读量:7089 次
发布时间:2019-06-28

本文共 1720 字,大约阅读时间需要 5 分钟。

function
>

strtoul                                                                           #include <stdlib.h> 

unsigned long int strtoul (const char* str, char** endptr, int base);
Convert string to unsigned long integer
Parses the C-string str, interpreting its content as an integral number of the specified base, which is returned as an value of type unsigned long int.
This function operates like  to interpret the string, but produces numbers of type unsigned long int (see for details on the interpretation process).

Parameters

str
C-string containing the representation of an integral number.
endptr
Reference to an object of type char*, whose value is set by the function to the next character in str after the numerical value.
This parameter can also be a null pointer, in which case it is not used.
base
Numerical base (radix) that determines the valid characters and their interpretation.
If this is 0, the base used is determined by the format in the sequence (see  for details).

Return Value

On success, the function returns the converted integral number as an unsigned long int value.
If no valid conversion could be performed, a zero value is returned.
If the value read is out of the range of representable values by an unsigned long int, the function returns ULONG_MAX(defined in ), and  is set to .

Example

1234567891011121314
/* strtoul example */#include 
/* printf, NULL */#include
/* strtoul */int main (){ char buffer [256]; unsigned long ul; printf ("Enter an unsigned number: "); fgets (buffer, 256, stdin); ul = strtoul (buffer, NULL, 0); printf ("Value entered: %lu. Its double: %lu\n",ul,ul*2); return 0;}
Possible output:
Enter an unsigned number: 0x7ffValue entered: 2047. Its double: 4094

转载地址:http://rlbql.baihongyu.com/

你可能感兴趣的文章
【转】spring boot web相关配置
查看>>
oc53--autorelease注意事项
查看>>
sigmod2017.org
查看>>
MongoDB集群运维笔记
查看>>
Python代码优化及技巧笔记(一)
查看>>
Caused by: java.lang.NoClassDefFoundError: org/apache/neethi/AssertionBuilderFactory
查看>>
Ocelot 集成Butterfly 实现分布式跟踪
查看>>
(转)各种语言写网络爬虫有什么优点缺点
查看>>
好用的端口监控软件:Port Explorer
查看>>
Cisco无线控制器配置Radius
查看>>
iota 币产生私钥的方法
查看>>
Mysql数据类型DECIMAL(M,D)用法
查看>>
006-Shell printf 命令
查看>>
leetcode 39. Combination Sum 40. Combination Sum II
查看>>
python测试开发django-4.获取url参数和name的作用
查看>>
C# IEnumerable和IEnumerator的区别,如何实现
查看>>
android adb命令行工具使用
查看>>
[转]聊聊.net程序设计——浅谈使用VS2010建模拓展
查看>>
Central Europe Regional Contest 2011
查看>>
每天一个linux命令(12):more命令
查看>>