Forum: Object-Pascal / Delphi-Language
Delphi
by Der schöne Günther,
27. Apr 2018
I do get you, and I understand what you want. It's just my personal opinion: I believe there is absolutely no use of putting this much work into all of this when everything you need is already there. It makes no sense to not read and write a few bytes.
Anyway :), the part above ("Seeking and Positioning") is important as well. When you only want to read the LastName part of your file, you will...
Forum: Object-Pascal / Delphi-Language
Delphi
by Der schöne Günther,
27. Apr 2018
I still don't understand the problem. Let's assume you change your local variable myRec to be a parameter of both LoadFromStream(..) and SaveToStream(..). They both now look like this:
Procedure SaveToStream(const myRec:Tmyrecord);
var
SavingStream: TFileStream;
begin
SavingStream := TFileStream.Create('SAVE.test', fmCreate or fmOpenWrite or fmShareDenyWrite);
try
...
Forum: Object-Pascal / Delphi-Language
Delphi
by Der schöne Günther,
27. Apr 2018
Can you post your real code? Your current LoadFromStream() and SaveToStream() appear to be testing routines because they contain syntax errors and, in their current form, do not make sense:
In LoadFromStream() you load your data into a local variable myRec. After that, your procedure ends and myRec is gone. You can inspect myRec in the debugger, but in the end, this method accomplishes...
Forum: Object-Pascal / Delphi-Language
Delphi
by Der schöne Günther,
27. Apr 2018
And then your next steps will probably be writing UpdateFirstName or UpdateId methods.
Why not
Load your data from stream
Alter them in memory
Save everything again
It looks like you already have everything you need.