(my)TinyLibC 0.0.1
little tiny pretty lib c
Loading...
Searching...
No Matches
tlcstdlibs.h File Reference

Go to the source code of this file.

Functions

int x_atoi (const char *x)
 string (in base 10) to int
 
int atoi_base (const char *nb, const char *base)
 string (in custom base) to int
 
char * x_calloc (int n)
 malloc n char and fill with 0
 
char ** x_ccalloc (int n)
 malloc n char * and fill with 0
 
char * x_itoa (int x)
 int to string (malloc'd) in base 10 (0123456789)
 
char * itoa_base (int nb, char const *base)
 int to string (malloc'd) in base len(base) (base)
 
double x_atod (char const *str)
 string (in base 10) to double
 
double x_atod_err (char const *str, int *is_error)
 string (in base 10) to double
 
float x_atof (const char *str)
 string (in base 10) to float
 
float x_atof_err (char const *str, int *is_error)
 string (in base 10) to float
 

Function Documentation

◆ atoi_base()

int atoi_base ( const char *  nb,
const char *  base 
)

string (in custom base) to int

len(base) must be > 1

Parameters
nbstring to convert
basebase to use (ex for base 10: "0123456789")
Returns
0 if any error;; the number (could be 0 too)

◆ itoa_base()

char * itoa_base ( int  nb,
char const *  base 
)

int to string (malloc'd) in base len(base) (base)

len(base) must be > 1

Parameters
nb
base
Returns
NULL if any error;; the string

◆ x_atod()

double x_atod ( char const *  str)

string (in base 10) to double

Parameters
strstring to convert
Returns
0 if any error;; the number (could be 0 too)

◆ x_atod_err()

double x_atod_err ( char const *  str,
int *  is_error 
)

string (in base 10) to double

Parameters
strstring to convert
is_errorif any error (is_error > 0 is an error)
Returns
0 if any error;; the number (could be 0 too)

◆ x_atof()

float x_atof ( const char *  str)

string (in base 10) to float

Parameters
strstring to convert
Returns
0 if any error;; the number (could be 0 too)

◆ x_atof_err()

float x_atof_err ( char const *  str,
int *  is_error 
)

string (in base 10) to float

Parameters
strstring to convert
is_errorif any error (is_error > 0 is an error)
Returns
0 if any error;; the number (could be 0 too)

◆ x_atoi()

int x_atoi ( const char *  x)

string (in base 10) to int

Parameters
xstring to convert
Returns
0 if any error;; the number (could be 0 too)

◆ x_calloc()

char * x_calloc ( int  n)

malloc n char and fill with 0

Parameters
nnumber to alloc
Returns
ptr to the first n allocated

◆ x_ccalloc()

char ** x_ccalloc ( int  n)

malloc n char * and fill with 0

Parameters
nnumber to alloc
Returns
ptr to the first n allocated

◆ x_itoa()

char * x_itoa ( int  x)

int to string (malloc'd) in base 10 (0123456789)

Parameters
xnumber to convert
Returns
NULL if any error;; the string