OpenersNotesSection(Spacer1)Details

The array a must be laid out in memory like a C array declared explicitly as unsigned char a[m][n]….

If heads is given as NULL, the array will be assumed to have head (RefLink[List, paclet:ref/List]) at every level.

The length of the array at level i is taken to be dims[i].

WSPutByteArray() returns 0 in the event of an error, and a nonzero value otherwise.

Use (NonWLLink[WSError(), paclet:ref/c/WSError]) to retrieve the error code if WSPutByteArray() fails.

WSPutByteArray() is declared in the WSTP header file (RefLink[wstp.h, paclet:ref/file/wstp.h]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)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 */ }
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[WSPutInteger16Array(), paclet:ref/c/WSPutInteger16Array])  ▪  (NonWLLink[WSPutInteger32Array(), paclet:ref/c/WSPutInteger32Array])  ▪  (NonWLLink[WSPutInteger64Array(), paclet:ref/c/WSPutInteger64Array])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[WSTP C API Developer Guide (Mac OS X), paclet:tutorial/WSTPDeveloperGuide-MacintoshOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Unix and Linux), paclet:tutorial/WSTPDeveloperGuide-UnixOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Windows), paclet:tutorial/WSTPDeveloperGuide-WindowsOverview])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Alphabetical Listing of WSTP C Functions, paclet:guide/AlphabeticalListingOfWSTPCFunctions])}, {▪(RefLinkPlain[WSTP C Functions for Exchanging Data, paclet:guide/WSTPCFunctionsForExchangingData])}, {▪(RefLinkPlain[WSTP C Functions for Exchanging Expressions, paclet:guide/WSTPCFunctionsForExchangingExpressions])}, {▪(RefLinkPlain[WSTP C Functions for Exchanging Multidimensional Arrays, paclet:guide/WSTPCFunctionsForExchangingMultidimensionalArrays])}})}})