How to write buffer to console lazarus / 21-General ---------------------------------------------------------------------- ydd · 2021-05-31 17:29 I have ABuf, ALen I know that writing to console uses Output (same as StdOut), so I need something like: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i BlockWrite(Output, ABuf, ALen); should be cross platform - at least Windows, Linux, x86, ARM ---------------------------------------------------------------------- MarkMLl · 2021-05-31 20:10 Iterate over it using Write()/WriteLn() possibly with the help of Format(). That's about as much as can be said given the lack of any information regarding what you actually expect to see. MarkMLl ---------------------------------------------------------------------- cdbc · 2021-05-31 20:51 Hi If the buffer contains pure text with linefeeds, you could use a TStringlist.Text and writeln the individual lines to console, should work on all platforms... Regards Benny ---------------------------------------------------------------------- MarkMLl · 2021-05-31 21:04 Quote from: cdbc on May 31, 2021, 10:51:45 pmIf the buffer contains pure text with linefeeds, you could use a TStringlist.Text and writeln the individual lines to console, should work on all platforms... Regards Benny Possibly, but allowing for the cross-platform aspect I'm concerned about the OP's expectations regarding line breaks etc. MarkMLl ---------------------------------------------------------------------- engkin · 2021-05-31 21:52 This seems to work on Windows. Give it a try and see if it works on Linux: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program Project1; {$mode objfpc}{$H+} uses  {$IFDEF UNIX}{$IFDEF UseCThreads}  cthreads,  {$ENDIF}{$ENDIF}  Classes, SysUtils  { you can add units after this }; var  hs:THandleStream;  s:string='';  buf:pchar;  i: Integer;begin  for i := 1 to 10 do    s:=s+'Test: '+IntToStr(i)+LineEnding;   hs:=THandleStream.Create(TextRec(Output).Handle);  try    buf:=@s[1];    hs.WriteBuffer(buf^,Length(s));  finally    hs.Free;  end;   readLn;end. Edit: Just tried it on Android and it worked. ---------------------------------------------------------------------- ydd · 2021-05-31 23:23 Quote from: engkin on May 31, 2021, 11:52:25 pmThis seems to work on Windows. Give it a try and see if it works on Linux: .. actually thank you for your idea, I updated it a little and it works on Windows & Linux: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure WriteBuf(ABuf: Pointer; ALen: Integer);begin  FileWrite(TextRec(Output).Handle, ABuf^, ALen);end; ---------------------------------------------------------------------- AdrianHamilton · 2021-06-03 11:33 Hi, for some reason it's not working for me.... I did exactly as you did and nothing changed! What could be the problem? ---------------------------------------------------------------------- jamie · 2021-06-03 15:15 Try the System.StdOutPutHandle instead.