myMPD
Internal API documentation
Loading...
Searching...
No Matches
convert.h File Reference

Type conversion functions. More...

#include <stdint.h>
Include dependency graph for convert.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  str2int_errno { STR2INT_SUCCESS , STR2INT_OVERFLOW , STR2INT_UNDERFLOW , STR2INT_INCONVERTIBLE }
 

Functions

enum str2int_errno str2int (int *out, const char *s)
 
enum str2int_errno str2uint (unsigned *out, const char *s)
 
enum str2int_errno str2int64 (int64_t *out, const char *s)
 
enum str2int_errno str2float (float *out, const char *s)
 

Detailed Description

Type conversion functions.

Enumeration Type Documentation

◆ str2int_errno

Return codes for conversion functions

Function Documentation

◆ str2float()

enum str2int_errno str2float ( float *  out,
const char *  s 
)

Convert string s to float out. The format is the same as strtof, except that the following are inconvertible: NULL, empty string, leading whitespace, any trailing characters

Parameters
outpointer to integer
sstring to convert
Returns
Indicates if the operation succeeded, or why it failed.

◆ str2int()

enum str2int_errno str2int ( int *  out,
const char *  s 
)

Convert string s to int out. The format is the same as strtol, except that the following are inconvertible: NULL, empty string, leading whitespace, any trailing characters

Parameters
outpointer to integer
sstring to convert
Returns
Indicates if the operation succeeded, or why it failed.

◆ str2int64()

enum str2int_errno str2int64 ( int64_t *  out,
const char *  s 
)

Convert string s to int64_t out. The format is the same as strtoll, except that the following are inconvertible: NULL, empty string, leading whitespace, any trailing characters

Parameters
outpointer to integer
sstring to convert
Returns
Indicates if the operation succeeded, or why it failed.

◆ str2uint()

enum str2int_errno str2uint ( unsigned *  out,
const char *  s 
)

Convert string s to unsigned out. The format is the same as strtoul, except that the following are inconvertible: NULL, empty string, leading whitespace, any trailing characters

Parameters
outpointer to integer
sstring to convert
Returns
Indicates if the operation succeeded, or why it failed.