Method: FFI::AbstractMemory#write_bytes

Defined in:
ext/ffi_c/AbstractMemory.c

#write_bytes(str, index = 0, length = nil) ⇒ self

equivalent to :

memory.put_bytes(0, str, index, length)

Parameters:

  • str (String)

    string to put to memory

  • index (Integer)
  • length (Integer)

    string’s length in bytes. If nil, a (memory size - offset) length string is returned).

Returns:

  • (self)


624
625
626
627
628
629
630
631
632
633
634
635
636
# File 'ext/ffi_c/AbstractMemory.c', line 624

static VALUE
memory_write_bytes(int argc, VALUE* argv, VALUE self)
{
    VALUE* wargv = ALLOCA_N(VALUE, argc + 1);
    int i;

    wargv[0] = INT2FIX(0);
    for (i = 0; i < argc; i++) {
        wargv[i + 1] = argv[i];
    }

    return memory_put_bytes(argc + 1, wargv, self);
}