i16toa

Name

i16toa -- converts integer to string

Synopsis

#include <stdlib.h>

void i16toa(long value, char * str, unsigned int radix);

Description

This function converts a signed long integer to a null-terminated ASCII string. It accepts a pointer to a string buffer, a value to be converted to a string representation, and the radix in which to represent the number.

Radix may be one of the following:

Table 1. Radix options

radix

representation

2

Binary

8

Octal

10

Decimal

16

Hexidecimal

The string buffer must be long enough to contain all characters created by the conversion. Therefore, the buffer must be sized as follows:

Table 2. Required buffer sizes

representation

size

Binary

18 bytes

Octal

8 bytes

Decimal

7 bytes

Hexadecimal

6 bytes

See Also

ui16toa, ui8toa, i8toa, stdlib

Examples

Converting integer to ASCII