kstrtouint(9)
β¨ NAME β¨
kstrtouint β convert a string to an unsigned int. This is the kstrtouint(9) page from the Kernel API Manual, and bestie, we are literally turning a string into an unsigned int. Main character conversion energy β¨π
π SYNOPSIS π
Hereβs the exact signature, no edits, no cap:
int kstrtouint (const char *s , unsigned int base , unsigned int *res );
πΈ ARGUMENTS πΈ
sβ the start of the string. It must be null-terminated, and it may also include a single newline before its terminating null. The first character may also be a plus sign, but not a minus sign.
π¨ Caveat check: plus sign? allowed. Minus sign? not allowed. Periodt.
baseβ the number base to use. The maximum supported base is16. Ifbaseis given as0, then the base of the string is automatically detected with the conventional semantics: if it begins with0x, the number will be parsed as hexadecimal (case insensitive); if it otherwise begins with0, it will be parsed as an octal number; otherwise it will be parsed as a decimal.resβ where to write the result of the conversion on success. Thatβs the output spot, bestie π―
π DESCRIPTION π
Returns 0 on success, -ERANGE on overflow, and -EINVAL on parsing error. Itβs preferred over simple_strtoul. The return code must be checked.
π Do not ghost that return code. Check it. Fr fr. The return code must be checked β that part is not a vibe suggestion.
π₯ SEE ALSO π₯
Kernel file ./lib/kstrtox.c, plus these iconic little references:
_parse_integer_limit(9)kstrtoull(9)kstrtoll(9)kstrtoint(9)kstrtobool(9)kstrtoudec64(9)kstrtodec64(9)
mwah π source/version: ./lib, date: October 2026, page: kstrtouint(9). Bye bestie, go check that return code π«Άβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms