Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
shell_string_conv.h File Reference
#include <stdbool.h>
#include <stdint.h>

Go to the source code of this file.

Functions

long shell_strtol (const char *str, int base, int *err)
 String to long conversion with error check.
 
unsigned long shell_strtoul (const char *str, int base, int *err)
 String to unsigned long conversion with error check.
 
unsigned long long shell_strtoull (const char *str, int base, int *err)
 String to unsigned long long conversion with error check.
 
bool shell_strtobool (const char *str, int base, int *err)
 String to boolean conversion with error check.
 

Function Documentation

◆ shell_strtobool()

bool shell_strtobool ( const char *  str,
int  base,
int *  err 
)

String to boolean conversion with error check.

Warning
On success the passed err reference will not be altered to avoid err check bloating. Passed err reference should be initialized to zero.
Parameters
strInput string.
baseConversion base.
errError code pointer: Set to -EINVAL on invalid string input. Set to -ERANGE if numeric string input is to large to convert. Unchanged on success.
Returns
Converted boolean value.

◆ shell_strtol()

long shell_strtol ( const char *  str,
int  base,
int *  err 
)

String to long conversion with error check.

Warning
On success the passed err reference will not be altered to avoid err check bloating. Passed err reference should be initialized to zero.
Parameters
strInput string.
baseConversion base.
errError code pointer: -EINVAL on invalid string input. -ERANGE if numeric string input is to large to convert. Unchanged on success.
Returns
Converted long value.

◆ shell_strtoul()

unsigned long shell_strtoul ( const char *  str,
int  base,
int *  err 
)

String to unsigned long conversion with error check.

Warning
On success the passed err reference will not be altered to avoid err check bloating. Passed err reference should be initialized to zero.
Parameters
strInput string.
baseConversion base.
errError code pointer: Set to -EINVAL on invalid string input. Set to -ERANGE if numeric string input is to large to convert. Unchanged on success.
Returns
Converted unsigned long value.

◆ shell_strtoull()

unsigned long long shell_strtoull ( const char *  str,
int  base,
int *  err 
)

String to unsigned long long conversion with error check.

Warning
On success the passed err reference will not be altered to avoid err check bloating. Passed err reference should be initialized to zero.
Parameters
strInput string.
baseConversion base.
errError code pointer: Set to -EINVAL on invalid string input. Set to -ERANGE if numeric string input is to large to convert. Unchanged on success.
Returns
Converted unsigned long long value.