Data Conversion - Argox PA-20 Programming Manual

Portable data terminal
Hide thumbs Also See for PA-20:
Table of Contents

Advertisement

__itoa
Purpose:
Use __itoa to convert an integer value to a null-terminated character string.
Syntax:
char * __itoa (int value, char *string, int radix);
__itoa(32, buffer, 16); /* buffer will contain "20" */
Example call:
#include "SDK.h"
Includes:
Description:
The __itoa function converts the int argument value into a null-terminated
character string using the argument radix as the base of the number
system. The resulting string with a length of up to 17 bytes is saved in the
buffer whose address is given in the argument string. You must allocate
enough room in the buffer to hold all digits of the converted string plus the
terminating null character (\0). For radixes other than 10, the sign bit is not
interpreted; instead, the bit pattern of value is simply expressed in the
requested radix. 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. When radix is 10 and the value is negative, the converted
string will start with a minus sign.
Returns:
The __itoa function returns the pointer to the string of degits (i.e., it returns
the argument string).
__ltoa
Purpose:
Use __ltoa to convert a long integer value to a null-terminated character
string.
Syntax:
char * __ltoa (long value, char *string, int radix);
__ltoa(0x10000, string, 10); /* string = "65536" */
Example call:
#include "SDK.h"
Includes:
Description:
The __ltoa function converts the long argument value into acharacter 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 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.
PT-20 Programming Guide

Data Conversion

106

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Pa-21Pa-2110Pa-2010

Table of Contents