Registriert seit: 21. Aug 2003
7.332 Beiträge
Delphi 2009 Professional
|
Re: Streams - negativen Wert mit Write schreiben???
14. Aug 2004, 09:23
Also,
ich habs jetzt selbst mal getestet:
Schreiben:
Delphi-Quellcode:
var
BuildValue: smallint;
MemoryStream: TMemoryStream;
begin
try
MemoryStream := TMemoryStream.Create;
//now open the file to check the type
MemoryStream.LoadFromFile('F:\Test.bin');
MemoryStream.Position := $1A;
BuildValue := BC.Value * 10;
MemoryStream.Write(BuildValue, 2);
MemoryStream.SaveToFile('F:\Test.bin');
finally
MemoryStream.Free;
end;
end;
Und so lesen:
Delphi-Quellcode:
var
BuildValue: smallint;
MemoryStream: TMemoryStream;
begin
try
MemoryStream := TMemoryStream.Create;
//now open the file to check the type
MemoryStream.LoadFromFile('F:\Test.bin');
MemoryStream.Position := $1A;
MemoryStream.Read(BuildValue, 2);
Edit2.Text := IntToStr(BuildValue);
finally
MemoryStream.Free;
end;
end;
Klappt alles wunderbar.
|