Link to home
Start Free TrialLog in
Avatar of furmiga
furmiga

asked on

Loading - reading - Showing ( memory )

Heya guyz... very easy... well not to me :P

I created a .txt with the number 5 inside... close it...

1 - I want to load the .txt file and save it into a MemoryStream
2 - Read this memory and, since its a number, save the value into a var ( integer type )
3 - use the integer var like showmessage(inttostr(intvar+5));
4 - get my 10 :P
5 - release the memory


ty in advance
Avatar of paulb1989
paulb1989

var
  IntVar: Integer;
  F: TStringList;
begin
  F := TStringList.Create;

  try
    F.LoadFromFile('myfile.txt');
    IntVar := StrToInt(F[0]); // First Line
    ShowMessage(IntToStr(IntVar + 5));
  finally
    F.Free;
  end;
end;
ASKER CERTIFIED SOLUTION
Avatar of paulb1989
paulb1989

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of furmiga

ASKER

Heyz man.. tx a lot :)