Recent

Author Topic: TStream queue different contents (SOLVED)  (Read 1399 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2261
    • Lazarus and Free Pascal italian community
TStream queue different contents (SOLVED)
« on: October 26, 2023, 11:08:19 am »
Hi, I need to put a string in the same TStream to which I append an image. The string is always 50 characters long.
I will have to send this stream over the network to another computer and extract the string and the image on this one. Can anyone explain to me how to append the two contents and then recover them?

Thank you
« Last Edit: October 26, 2023, 12:54:49 pm by xinyiman »
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

cdbc

  • Hero Member
  • *****
  • Posts: 2807
    • http://www.cdbc.dk
Re: TStream queue different contents
« Reply #1 on: October 26, 2023, 11:22:34 am »
Hi
Hmmm... Maybe:
Code: Pascal  [Select][+][-]
  1. ...
  2.   Strm.Write(S[1],50); // not nice, but you said 50 chars
  3.   Bmp.SaveToStream(Strm);
  4.   // on the other side:
  5.   SetLength(S,50);
  6.   Strm.Read(S[1],50));
  7.   Bmp.LoadFromStream(Strm);
  8.  
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

xinyiman

  • Hero Member
  • *****
  • Posts: 2261
    • Lazarus and Free Pascal italian community
Re: TStream queue different contents
« Reply #2 on: October 26, 2023, 12:54:39 pm »
Perfect, thank you
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

 

TinyPortal © 2005-2018