ReadMem(file_id, blk_id, len[, offset])
len
bytes raw data from an open
file (specified by file_id
, use OpenFile() to open files) to a memory
block (specified by blk_id
). Additionally you can specify the optional
offset
argument to define where in the memory block the raw data shall
be stored. The data from the source file is read from the current cursor
position in the file which you can modify using the Seek() command.
len = FileSize("C:SetPatch") OpenFile(1, "C:SetPatch", #MODE_READ) AllocMem(1, len) ReadMem(1, 1, len) CloseFile(1) OpenFile(1, "Ram:Copy_of_SetPatch", #MODE_WRITE) WriteMem(1, 1, len) CloseFile(1) FreeMem(1)Makes a copy of the SetPatch program in RAM: by using the two raw data i/o functions
ReadMem()
and WriteMem().