embtextf  20130407
Embedded System Text Formatting
 All Files Functions Typedefs Macros Pages
Functions
xtoa.h File Reference

Utility functions for converting from integer to ASCII representations. More...

Go to the source code of this file.

Functions

char * embtextf_itoa (int value, char *str, int radix)
 
char * embtextf_utoa (unsigned int value, char *str, int radix)
 
char * embtextf_ltoa (long value, char *str, int radix)
 
char * embtextf_ultoa (unsigned long value, char *str, int radix)
 
char * embtextf_lltoa (long long value, char *str, int radix)
 
char * embtextf_ulltoa (unsigned long long value, char *str, int radix)
 

Detailed Description

Utility functions for converting from integer to ASCII representations.

Mixed-Base Integer to String Conversion Functions

The routines in this module convert signed and unsigned int and long values into text expressed in base 2 through base 36 and stored a user-provided buffer.

Homepage
http://github.com/pabigot/embtextf

Function Documentation

char* embtextf_itoa ( int  value,
char *  str,
int  radix 
)

Convert value into text representation.

The value is converted into a base-radix ASCII representation. If the radix is 10 and value is negative a minus sign will be generated prior to representation of the absolute value of the input.

Parameters
valuethe number to be converted
stra buffer of sufficient size to hold the ASCII representation of the value in the given base, including a terminating NUL. Passing an insufficiently large buffer results in undefined behavior.
radixthe radix for the ASCII representation. Valid values are 2 through 36. Multiples greater than 9 are represented by capitalized alphabetics beginning with A (10) and continuing through Z (35). Passing an invalid value results in undefined behavior.
Returns
a pointer into str beginning at the first character of the ASCII representation of the value.
char* embtextf_lltoa ( long long  value,
char *  str,
int  radix 
)

As with itoa() but for long long integers.

char* embtextf_ltoa ( long  value,
char *  str,
int  radix 
)

As with itoa() but for long integers.

char* embtextf_ulltoa ( unsigned long long  value,
char *  str,
int  radix 
)

As with itoa() but for unsigned long long integers.

char* embtextf_ultoa ( unsigned long  value,
char *  str,
int  radix 
)

As with itoa() but for unsigned long integers.

char* embtextf_utoa ( unsigned int  value,
char *  str,
int  radix 
)

As with itoa() but for unsigned integers.