I see I think I get it but I'm no sure. I'm trying to replace this series of statements that were written for a GDNative plugin
. GDNative plugins
have access to File::get_buffer
which only requires a p_length
. Here is the original code:
/* Read and populate the data */
PoolByteArray arr = p->file->get_buffer(len);
PoolByteArray::Read r = arr.read();
memcpy(zBuf, r.ptr(), len);
Here is what I did, but I'm pretty sure it's wrong:
/* Read and populate the data */
PoolVector<uint8_t> arr;
arr.resize(len);
PoolVector<uint8_t>::Write arr_w = arr.write();
p->file->get_buffer(arr_w.ptr(), len);
PoolByteArray::Read r = arr.read();
memcpy(zBuf, r.ptr(), iAmt);
What do you think?
[EDIT]
Aaaaactually there seems to be _File
class in core_bind.h
, which I think is the class that is exposed to GDNative
and GDscript
right?