1 Attachment(s)
Load values from end of file (exe)
Hello.
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:
Attachment 11312
I found the function LoadFromEXE, but in Delphi:
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[1], Length(Result));
XXX := Result;
finally
CloseFile(F);
end;
end;
How to do it in C++?
// Sorry for my english.
Greetings,
Kirgeron