Main Index : Reference :
[bytes] memset([bytes] mem,[int] byte,[int] pos,[int] num)
mem is the original byte array.byte is the byte to fill with.pos is the starting position of the filling.num is the number of times that the byte is repeated. (num >= 0)
memset() returns a copy of mem that is filled from position pos to position pos+num with the integer byte. The length of the return value is always the length of mem. If any position of the specified fill interval is outside of mem, for example if pos+num is greater than the length of mem, it is simply disregarded. The starting position, pos, can be negative.
Hexadecimal numbers are written like this: 0xEF = 239.
Remember: The first element of a byte array is at position 0.
// See also the examples for strset().
// The resulting byte array will be filled with FF's.
var mem = new(bytes,512);
var result = memset(mem,0xFF,0,512);