Guardian C Library Calls Reference Manual

stcu_d (supplementary)
3-186 128833Guardian TNS C Library Calls Reference Manual
Reference to Library Calls
stcu_d (supplementary)
The stcu_d function converts an unsigned integer to a string of decimal characters.
str_ptr
points to the string where stcu_d stores the converted decimal value.
value
is the integer to convert.
str_size
specifies the number of bytes in *str_ptr.
Return Value
is the length of the resulting string, except for the terminating null character.
Usage Guidelines
The stcu_d function appends a null character to the resulting string.
If value is zero, the converted string contains a single zero character.
Example
This example converts the unsigned integer 65432 to a string:
#include <stdlibh>
#include <stdioh>
int main(void)
{
unsigned num;
size_t length;
char string[10];
num = 65432;
length = stcu_d(string, num, 10);
/* convert to string form */
printf("%s", string); /* prints "65432" */
}
#include <stdlibh>
int stcu_d(char *str_ptr, unsigned value, int str_size);