When executing the code below the FileHandle::ReadFile method reading into an int fails. I tried reading with sizes 1 and 4, both with the same result.
User error: We are supposed to pass in an array, not a singular value. So read of int readByte[1]; with the reading size of 4 works as intended.
Reason: Access violation. Illegal write by 0x7ffcbcb1140c at 0x0
Class: 'UF_SelfExecute'
Function: 'TestLoad'
[memcpy]: ??? addr:0x7ffcbcb1140c
[zlibVersion]: ??? addr:0x7ff621c50eef
[zlibVersion]: ??? addr:0x7ff621c50c46
class UF_SelfExecute { static const ref UF_SelfExecute m_pSelfInstance = new UF_SelfExecute(); void UF_SelfExecute() { TestSave(); TestLoad(); } void TestSave() { FileSerializer file(); int bytes[3] = {1, 42, 1337}; if (file.Open("test.bin", FileMode.WRITE)) { file.Write(bytes); file.Close(); } } void TestLoad() { FileHandle handle = FileIO.OpenFile("test.bin", FileMode.READ); if (handle) { int readByte; for(int n = 0; n < 5; n++) { PrintFormat("Read: %1 - Value: %2", handle.ReadFile(readByte, 4), readByte); // <----------- crash caused by this line } handle.CloseFile(); } } }