basic.%memxcpy

C Function/BASIC Program, Releases: AP/Unix

Copies memory and converts to hexadecimal.

Syntax

variable=(char*)%memxcpy(s1, s2, number )

Description

copies 'number/2' characters from memory area 's2' into 's1', and converts each input character into two ASCII hexadecimal characters '0' to '9' and 'A' to 'F'.

's1' and 's2' are either Pick/BASIC strings or pointers to a character. 'variable' is a pointer after the last converted character in 's2' . If 's2' is a Pick string, the value returned by this function has no meaning.

Example

* Obtain Unix space
ptr=(char*)%malloc( 2048 )
* Read from Unix file
n=%read( fd, (char*)ptr, 1024 )
* Convert the binary data into HEX ASCII
char buffer[2048]
%memxcpy( buffer, (char*)ptr, n*2 )

See Also

Command Name Type Description
basic.cfunction Definition Declare a list of C functions.
basic.cfunc Definition can be called from a Pick/BASIC program or subroutine in AP/DOS and AP/Unix implementations using a syntax similar to that of normal C.
basic.%memccpy C Function Copies memory up to a delimiter.
basic.%memcpy C Function Copies memory.

User Comments

What do you think?

Share your experience or ask a question by using the form below.

Login to leave your comments.