Formats a decimal value.
Syntax
mint dectoasc(dec_t *np, char *cp, mint len, mint right);
- np is a pointer to the decimal structure to convert to a text string.
- cp is a pointer to the first byte of the character buffer to hold the text
string.
- len is the size of the string buffer, in bytes, minus 1 for the null terminator.
- right is an integer that indicates the number of decimal places to the right of the
decimal point.
- Because the character string that dectoasc() returns is not null terminated, your program
must add a null character to the string before you print it.
Returns
Table 1. Return codes
Code |
Description |
0 |
The conversion was successful. |
<0 |
The conversion failed. |
Usage
To convert a decimal value to an ASCII string, specifying the length of the string and the
number of digits to the right of the decimal point.