RWalib C Array Library User Guide > Type Conversion > alibByte
  

alibByte
Converts an array to type UCHAR. The PV-WAVE API to this routine is the BYTE Function.
Prototypes
void alibBytes( wvlong n, short *p, UCHAR *r )
void alibBytei( wvlong n, int *p, UCHAR *r )
void alibBytel( wvlong n, wvlong *p, UCHAR *r )
void alibBytef( wvlong n, float *p, UCHAR *r )
void alibByted( wvlong n, double *p, UCHAR *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 UCHAR.
Example
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "alib.h"
void main() {
    short  s0[9] = {0,1,2,3,4,5,6,7,8};
    UCHAR *s;
    s = (UCHAR*)malloc(9*sizeof(UCHAR));
    alibinit( NULL, NULL, NULL, NULL );
    alibPrintArrays( 1, 1, 1, 9, s0, NULL );
    alibBytes( 9, s0, s );
    alibPrintArrayb( 1, 1, 1, 9, s, NULL );
}
 
Output:
 
       0       1       2       3       4       5       6       7       8
 
   0   1   2   3   4   5   6   7   8

Version 2017.1
Copyright © 2019, Rogue Wave Software, Inc. All Rights Reserved.