ZEDA  1.6.18
Macros | Functions
convert value from/to string.

Macros

#define itoa_zerofill(v, s, b)   itoa_fill( (v), (s), '0', (b) )
 convert an integer to a string with blank filled by a charactor-zero. More...
 

Functions

int atox_c (char c)
 convert a hexadecimal note to a value. More...
 
int atox (char *str)
 convert hexadecimal string to value. More...
 
char * itoa (int val, char *buf)
 convert an integer to a string. More...
 
char * ftoa (double val, char *buf)
 convert a d-float value to a string. More...
 
char * itoa_fill (int val, int size, char pat, char *buf)
 convert an integer to a string with a blank filled by a charactor. More...
 
char * itoa_ordinal (int val, char *buf, size_t size)
 convert an integer number to a string that represents an ordinal. More...
 

Detailed Description

Macro Definition Documentation

◆ itoa_zerofill

#define itoa_zerofill (   v,
  s,
 
)    itoa_fill( (v), (s), '0', (b) )

convert an integer to a string with blank filled by a charactor-zero.

Returns
a pointer buf.
See also
itoa_fill

Function Documentation

◆ atox_c()

int atox_c ( char  c)

convert a hexadecimal note to a value.

atox_c() converts a charactor c which denotes a hexadecimal value to an integer value.

Returns
an integer value converted.

◆ atox()

int atox ( char *  str)

convert hexadecimal string to value.

atox() converts a string str which denotes hexadecimal value to an integer value.

if c is neither 0-9 nor a-f, it warns and returns zero. if str includes non-hexadecimal charactors, it warns and skips them. Ex. a string "1g2h3i" is converted to 102030.

Returns
an integer value converted.

◆ itoa()

char* itoa ( int  val,
char *  buf 
)

convert an integer to a string.

itoa() converts an integer val to an ASCII string and copies it to an array pointed by buf.

Returns
a pointer buf.
Note
itoa() does not check the size of buf. It assumes that 'buf' has an enough size.

◆ ftoa()

char* ftoa ( double  val,
char *  buf 
)

convert a d-float value to a string.

ftoa() converts a double-precision floating point value val to an ASCII string and copies it to an array pointed by buf.

Returns
a pointer buf.
Note
itoa() does not check the size of buf. It assumes that 'buf' has an enough size.

◆ itoa_fill()

char* itoa_fill ( int  val,
int  size,
char  pat,
char *  buf 
)

convert an integer to a string with a blank filled by a charactor.

itoa_fill() converts a given integer val to a string with its blank filled by pat. size is the length of the string. If the digit of val is more than size, size is ignored.

Examples:

1.when calling itoa_fill( 12, 5, '*', buf );, the string will be "***12".

2.when calling 'itoa_fill( 123, 2, '?', buf );', the string will be "123".

Returns
a pointer buf.
Note
itoa_fill() is not available in ther kernel space.

◆ itoa_ordinal()

char* itoa_ordinal ( int  val,
char *  buf,
size_t  size 
)

convert an integer number to a string that represents an ordinal.

itoa_ordinal() converts an integer number val into a string that represents an ordinal, and stores it into buf. size is the size of buf.

Returns
itoa_ordinal() returns a pointer buf.