RWalib C Array Library User Guide > Type Conversion > alibShort
  

alibShort
Converts an array to type short. The PV-WAVE API for this routine is the FIX Function.
Prototypes
void alibShortb( wvlong n, UCHAR *p, short *r )
void alibShorts( wvlong n, short *p, short *r )
void alibShorti( wvlong n, int *p, short *r )
void alibShortl( wvlong n, wvlong *p, short *r )
void alibShortf( wvlong n, float *p, short *r )
void alibShortd( wvlong n, double *p, short *r )
Parameters
n — (Input) The number of elements in the source array.
*p — (Input) The n-element source array.
*r — (Input/Output) The n-element destination array. On return, r is the array obtained from array p by converting each of its elements to type short.
Example
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "alib.h"
void main() {
    UCHAR  b0[9] = {0,1,2,3,4,5,6,7,8};
    short *b;
    b = (short*)malloc(9*sizeof(short));
    alibinit( NULL, NULL, NULL, NULL );
    alibPrintArrayb( 1, 1, 1, 9, b0, NULL );
    alibShortb( 9, b0, b );
    alibPrintArrays( 1, 1, 1, 9, b, NULL );
}
 
Output:
 
   0   1   2   3   4   5   6   7   8
 
       0       1       2       3       4       5       6       7       8

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.