I'm writing an application which saving some values to EXE file.
I wrote 'SaveToEXE' function.
Now I've got a problem.
How to read saved values in EXE file? Values are stored at the end of the file. How to read this string:
I found the function LoadFromEXE, but in Delphi:
How to do it in C++?Code:FUNCTION LoadFromFile(FName: string): string; var F: File of Byte; I: Integer; begin Result := ''; AssignFile(F, FName); FileMode := fmOpenRead; Reset(F); try Seek(F, FileSize(F) - SizeOf(I)); BlockRead(F, I, SizeOf(I)); if (I < SizeOf(I)) or (I > FileSize(F)) then Exit; Seek(F, FileSize(F) - I); SetLength(Result, I - SizeOf(I)); BlockRead(F, Result, Length(Result)); XXX := Result; finally CloseFile(F); end; end;
// Sorry for my english.