将相应的字符串转换为相应的数字

时间:2014-04-30 22:36:38   收藏:0   阅读:198

#include <stdio.h>
#include <stdlib.h>


int main(void)
{
char* ch = "ff000000";
unsigned i = strtoul(ch, NULL, 16);


printf("%u\n", i);


return 0;
}


strtoul 是将字符串转换为无符号长整型

strtol  是将字符串转换为整型


可以查看微软的帮助文档


参照百度:

http://baike.baidu.com/view/1874375.htm

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!