Ultoa – Argox PA-20 Programming Guide User Manual

Page 109

Advertising
background image

PT-20 Programming Guide

107

When radix is 10 and the value is negative, the converted string will start

with a minus sign.

Returns: The __ltoa function returns the pointer to the converted string (i.e., it

returns the argument string).

__ultoa

Purpose: Use __ultoa to convert an unsigned long integer value to a character string.

Syntax: char * __ultoa (unsigned long value, char *string, int radix);

Example call:

__ultoa(0x20000, string, 10); /* string = “131072” */

Includes:

#include “SDK.h”

Description: The __ultoa function converts the unsigned long argument value into a

null-terminated character string using the argument radix as the base of the

number system. A long integer has 32 bits when expressed in radix 2, so

the string can occupy a maximum of 33 bytes with the terminating null

character. The resulting string is returned by __ultoa in the buffer whose

address is given in the argument string. The argument radix specifies the

base (between 2 and 36) of the number system in which the string

representation of value is expressed. For example, using either 2, 8, 10, or

16 as radix, you can convert value into its binary, octal, decimal, or

hexadecimal representation, respectively.

Returns: The __ultoa function returns the pointer to the converted string (i.e., it

returns the argument string).

Advertising