WSPutByteArray (C Function)
int WSPutByteArray(WSLINK link,const unsigned char *a,const int *dims,const char **heads,int d)
puts an array of integers in the range 0–255 to the WSTP connection specified by to form a depth- array with dimensions .
Details
- The array must be laid out in memory like a C array declared explicitly as .
- If is given as NULL, the array will be assumed to have head List at every level.
- The length of the array at level is taken to be .
- WSPutByteArray() returns 0 in the event of an error, and a nonzero value otherwise.
- Use WSError() to retrieve the error code if WSPutByteArray() fails.
- WSPutByteArray() is declared in the WSTP header file wstp.h.
Examples
Basic Examples (1)
#include "wstp.h"
/* send a list of integers in the range 0-255 to a link */
void f(WSLINK lp)
{
unsigned char array[10][5][3][4];
long dims[4];
int i;
for(i = 0; i < 600; i++)
*((unsigned char *)array + i) = i;
dims[0] = 10;
dims[1] = 5;
dims[2] = 3;
dims[3] = 4;
if(! WSPutByteArray(lp, (unsigned char *)array, (long *)dims, (char **)0, 4))
{ /* unable to send array of integers to lp */ }
}