Converts a decimal string in a field to a long integer variable
| Call | |||
| #include <vv_dec.h> | |||
| int dc_todec(stp, datap, dfldp, cvbufp) | |||
|
UCHAR *stp |
Pointer to string with user's field input |
||
| PTR datap | Pointer to variable to receive converted field input | ||
| DFIELDPTR dfldp | Pointer to a data field structure | ||
| PTR cvbufp | Pointer to a data conversion buffer | ||
| Returns | |||
| 1 | Success. This is the only return value for this function | ||
| Description
dc_todec() makes a copy of the field string in the conversion buffer. All thousands separators are removed from the string and the number of decimal locations in the string is adjusted to match the number of decimal locations specified by the picture for the field. If there are too few digits after the decimal, trailing zeros are added. If there are too many digits after the decimal, the extra digits are truncated. After this is done, the decimal character is deleted and the string is converted to a long integer. Some examples are as follows: |
|||
| Field Picture | Decimal string | Stored value | |
| ######@## | -1.2 | -120 | |
| #####@### | 123.45678 | 123456 | |
| 99.99 | 123.45678 | 1230 | |
| Related Functions | |||
| Cautions
No error checking is performed on the input string. dc_todec() assumes that vf_dec() has already validated the string. |
|||