basic.%memcpy C Function/BASIC Program


Command basic.%memcpy C Function/BASIC Program
Applicable release versions: AP/Unix
Category BASIC Program (486)
Description copies the number of characters specified by "number" from memory area "s2" into "s1".

"s1" and "s2" are either Pick/BASIC strings or pointers to a character. "variable" is a pointer to "s1". If "s1" is a Pick string, the value returned by this function has no meaning.
Syntax variable=(char*)%memcpy(s1, s2, number )
* Read 1024 bytes from device
* and copy them in a Pick buffer
precision 0
char buffer[1024]
p=(char*)%malloc( 1024 )
n=%read(fd, (char*)p, 1024 )
%memcpy( buffer, p+32, n-32 )

In this example, note the operation on pointers, allowed because of the 
statement  'precision 0'. This allows reading data from a device, and 
copy only the portion after a fixed size header (32 bytes in this example).
Related basic.cfunc