carta
strict_strtoul(9)

strict_strtoul9

Convert a string to an unsigned long strictly

Arguments

cp

The string to be converted

base

The number base to use

res

The converted result value

Overview

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.

History

  • Debian 6.0 (Squeeze): the text shown here
  • Debian 5.0 (Lenny)

From linux-manual-2.6.32 2.6.32-48squeeze6 in Debian 6.0 (Squeeze). Parsed by carta from the page's man source.