strpack()

strpack()

Description

Create a “packed” copy of a string.

Syntax

strpack(dest[], source[], maxlength);

Parameters

Variable

Input

Variable

Input

dest

The buffer to store the unpacked string in.

source

The string to copy, this may be a packed or an unpacked string.

maxlength

The size of destin cells. If the length of destwould exceed maxlengthcells, the result is truncated.

Returns

The number of characters copied.

Function call example

Example of copying packed string
new data1[20]; new array2[20]=''oldTextold''; main(){ strpack(data1, array2, sizeof data1); // result of data1 will be (in ASCII): oldTextold<0><0><0><0><0><0><0><0><0><0> packed string while(1){ Delay(100); } }

Notes and Warnings

This function copies a string from source to dest and stores the destination string in packed format. The source string may either be a packed or an unpacked string.