Author: Tomas Rutkauskas
How can I write a number (integer, float, etc.) to a stream? I am trying to save
the contents of a TList to a TFileStream. First I have to save the count of the
number of items in the list and save the count.
Answer:
1 var2 S: TMemoryStream;
3 I: LongInt;
4 begin5 S := TMemoryStream.Create;
6 try7 I := 1234;
8 S.write(I, SizeOf(I));
9 finally10 S.Free;
11 end;
12 end;