informix
INFORMIX-ESQL/C Programmer's Manual
ESQL/C Function Library

dectoint()

The dectoint() function converts a decimal type number into a C int type number.

Syntax

Usage

The dectoint() library function converts a decimal value to a C integer. The size of a C integer depends on the hardware and operating system of the computer you are using. Therefore, the dectoint() function equates an integer value with the SQL SMALLINT data type. The valid range of a SMALLINT is between 32767 and -32767. To convert larger decimal values to larger integers, use the dectolong() library function.

Return Codes

0 The conversion was successful.
<0 The conversion failed.
-1200 The magnitude of the decimal type number is greater than 32767.

Example

The file dectoint.ec in the demo directory contains the following sample program.

Output


INFORMIX-ESQL/C Programmer's Manual, Version 9.21
Copyright © 1999, Informix Software, Inc. All rights reserved