Memcpy

memcpy

Description:
Function memcpy copy bytes from one location to another.
This function name starts with a lowercase letter.


Parameters:
(dest[], const source[], index = 0, numbytes, maxlength = sizeof dest)
string dest An array into which the bytes from source are copied in.
string source The source array.
int index The start index in bytes in the destination array where the data should be copied to.
int numbytes The number of bytes (not cells) to copy.
int maxlength The maximum number of cells that fit in the destination buffer.


Return Values:
  • True on success.
  • False on failure.


Examples:
//Concatenate two strings with memcpy
new destination[64] = "This is ";
new source[] = "a string in a 32 Bit Array";
memcpy(destination, source, strlen(destination) * 4, sizeof source * 4, sizeof destination);
print(destination);
//Output: This is a string in a 32 Bit Array


Related Functions
The following functions may be useful, as they are related to this function in one way or another.
  • strlen: Get the length of a string.
  • strpack: Pack a string. Packed strings use 75% less memory.
  • strunpack: Unpack a string.
  • strcat: Concatenates (joins together) two strings into the destination string.
  • strmid: Extract a range of characters from a string.
  • strins: Insert a string into another string.
  • strdel: Delete part of a string.
  • strcmp: Compares two strings to see if they are the same.
  • strfind: Search for a sub string in a string.
  • strval: Convert a string to an integer.
  • valstr: Convert an integer into a string.
  • ispacked: Checks if the given string is packed.
  • uudecode: Decode an UU-encoded string.
  • uuencode: Encode a string to an UU-decoded string.