= memset =
== Syntax == void* memset(void *dest, int val, int n) == Arguments == :dest ::The memory block to copy data to :val ::The value that all the bytes in the memory block will be set to, up to the provided length :n ::The number of bytes to be set == Return == Returns a pointer to the destination (dest) memory block. == Description == memset sets each byte in the memory block to the given value/character, up to the number of bytes given. == Example == <code> %fml OnFilterStart: { // Allocate 1000 bytes of memory char* strbuffer; strbuffer = malloc(1000); // Fill the memory block with zeros memset(strbuffer, 0, 1000); // Set short lengths to a letter, // progressively overwriting them memset(strbuffer, 'e', 10); memset(strbuffer, 'D', 8); memset(strbuffer, 'c', 6); memset(strbuffer, 'B', 4); memset(strbuffer, 'a', 2); // Prints 'aaBBccDDee' printf("%s", strbuffer); // Release the memory again free(strbuffer); return true; }</code> == See Also == |