Other APIs

This chapter describes other APIs than the ones described in previous chapters.

1. pfmCalcAge

Gets a resident registration number and calculates the numbers of years, months, and days s/he has lived.

  • Prototype

    long pfmCalcAge(char *regnum, char *basedate, long *yyyy, long *mm, long *dd);
  • Parameters

    Parameter Description

    *regnum (input)

    Resident registration number.

    *basedate (input)

    Base date.

    *yyyy (output)

    Number of years s/he has lived.

    *mm (output)

    Number of months s/he has lived.

    *dd (output)

    Number of days s/he has lived.

  • Return values

    Return value Description

    RC_NRM

    This API is executed successfully.

    RC_ERR

    There is an input error.

  • Example

    long yyyy;
    long mm;
    long dd;
    rc = pfmCalcAge( "7501011nnnnnn", "20080301", &yyyy, &mm, &dd);
    if ( rc != RC_NRM )
    {
        PFM_ERR("%s", pfmStrGetErrorMsg());
        return RC_ERR;
    }

2. PFM_MIN

Gets two values and returns the smaller one.

  • Prototype

    PFM_MIN(A, B);
  • Parameters

    Parameter Description

    A (input)

    First input value of the short, integer, long, float, double, or other type.

    B (input)

    Second input value of the short, integer, long, float, double, or other type.

  • Return values

    Returns the samaller value.

  • Example

    /* PFM_MIN(-3, 5) == -3 */
    /* PFM_MIN(1, 5) == 1 */
    /* PFM_MIN(5.111, 5.112) == 5.111 */
    /* PFM_MIN(-5.111, -5.112) == -5.112 */

3. PFM_MIN3

Gets three values and returns the smallest one.

  • Prototype

    PFM_MIN3(A, B, C);
  • Parameters

    Parameter Description

    A (input)

    First input value of the short, integer, long, float, double, or other type.

    B (input)

    Second input value of the short, integer, long, float, double, or other type.

    C (input)

    Third input value of the short, integer, long, float, double, or other type.

  • Return values

    Returns the samallest value.

  • Example

    /* PFM_MIN3(-3, 5, -1) == -3 */
    /* PFM_MIN3(1, 5, 3) == 1 */
    /* PFM_MIN3(5.111, 5.112, 5.113) == 5.111 */
    /* PFM_MIN3(-5.111, -5.112, -5.113) == -5.113 */

4. PFM_MAX

Gets two values and returns the larger one.

  • Prototype

    PFM_MAX(A, B);
  • Parameters

    Parameter Description

    A (input)

    First input value of the short, integer, long, float, double, or other type.

    B (input)

    Second input value of the short, integer, long, float, double, or other type.

  • Return values

    Returns the larger value.

  • Example

    /* PFM_MAX(-3, 5) == 5 */
    /* PFM_MAX(1, 5) == 5 */
    /* PFM_MAX(5.111, 5.112) == 5.112 */
    /* PFM_MAX(-5.111, -5.112) == -5.111 */

5. PFM_MAX3

Gets three values and returns the largest one.

  • Prototype

    PFM_MAX3(A, B, C);
  • Parameters

    Parameter Description

    A (input)

    First input value of the short, integer, long, float, double, or other type.

    B (input)

    Second input value of the short, integer, long, float, double, or other type.

    C (input)

    Third input value of the short, integer, long, float, double, or other type.

  • Return values

    Returns the largest value.

  • Example

    /* PFM_MAX3(-3, 5, 7) == 7 */
    /* PFM_MAX3(-1, -5, -7) == -1 */
    /* PFM_MAX3(5.111, 5.112, 5.113) == 5.113 */
    /* PFM_MAX3(-5.111, -5.112, -5.113) == -5.111 */

6. PFM_ABS

Returns an absolute value of an input value.

  • Prototype

    PFM_ABS(A);
  • Parameters

    Parameter Description

    A (input)

    Input value of the short, integer, long, float, double, or other type.

  • Return values

    Returns an absolute value of an input value.

  • Example

    /* PFM_ABS(3) == 3 */
    /* PFM_ ABS(-7) == 7 */
    /* PFM_ ABS(5.112) == 5.112 */
    /* PFM_ ABS(-5.111) == 5.111 */