Recent

Author Topic: [SOLVED] Writing to TStream is not supported  (Read 828 times)

wittbo

  • Jr. Member
  • **
  • Posts: 69
[SOLVED] Writing to TStream is not supported
« on: January 28, 2019, 01:44:51 pm »
I'm trying to write a stringlist into a stream:

...
slMessage: TStringList;
srMessage: TStream;

...
srMessage := TStream.Create;
slMessage.SaveToStream (srMessage)

Upon compiling no error. When running the program, there is an error message "Writing to TStream is not supported." Is this generally the case on macos?
« Last Edit: January 28, 2019, 03:21:01 pm by wittbo »
-wittbo-
Lazarus 2.0.4  with FPC 3.0.4a
MBAir with MacOS 10.14.5
iMac with MacOS 10.13.6

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7508
Re: Writing to TStream is not supported
« Reply #1 on: January 28, 2019, 01:55:34 pm »
No, that is normal. Tstream is mostly an abstract base class, instantiate the class with TFIleStream or TMemoryStream.

wittbo

  • Jr. Member
  • **
  • Posts: 69
Re: Writing to TStream is not supported
« Reply #2 on: January 28, 2019, 03:20:39 pm »
TMemoryStream works as expected.
Sorry for my stupid question.
-wittbo-
Lazarus 2.0.4  with FPC 3.0.4a
MBAir with MacOS 10.14.5
iMac with MacOS 10.13.6