Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2112913
  • 博文数量: 374
  • 博客积分: 7276
  • 博客等级: 少将
  • 技术积分: 5668
  • 用 户 组: 普通用户
  • 注册时间: 2011-10-06 16:35
文章分类

全部博文(374)

文章存档

2013年(23)

2012年(153)

2011年(198)

分类: LINUX

2012-03-23 16:31:00

Name

strict_strtoul — convert a string to an unsigned long strictly

Synopsis
int strict_strtoul (const char *  cp,
 unsigned int  base,
 unsigned long *  res);
Arguments
cp

The string to be converted

base

The number base to use

res

The converted result value

Description

strict_strtoul converts a string to an unsigned long only if the string is really an unsigned long string, any string containing any invalid char at the tail will be rejected and -EINVAL is returned, only a newline char at the tail is acceptible because people generally

change a module parameter in the following way

echo 1024 > /sys/module/e1000/parameters/copybreak

echo will append a newline to the tail.

It returns 0 if conversion is successful and *res is set to the converted value, otherwise it returns -EINVAL and *res is set to 0.

simple_strtoul just ignores the successive invalid characters and return the converted value of prefix part of the string.

阅读(5689) | 评论(0) | 转发(1) |
0

上一篇:git-rebase命令解释

下一篇:memchr

给主人留下些什么吧!~~