Simple Project output - where's da console? lazarus / 32-Linux ---------------------------------------------------------------------- decuser · 2024-02-04 22:53 I have a simple project: 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 EatAtJoes; USES Crt; begin  ClrScr;  GotoXY(10,5);  Writeln('Eat at Joe''s!');  GotoXY(10,7);  Writeln('Ten Million Flies Can''t ALL be wrong!');  Readln;end.    I click run and nothing shows up. After a google search, I see stuff about adding Readln to get it to wait for input. Since I already have it, I'm stumped until I locate the View->Debug Windows->Console In/Output. So, I run that and it pops up with a very nice window that shows something called 'Raw Output' It doesn't look that raw... [6n[H[m[H[2J[5;10HEat at Joe's! looks to me like some control characters and my string. I don't mind, but none of the options gets to what I'd like, which is just my strings showing as what I would get with any terminal app. So, my questions are: 1. Is it possible to get the output to go to a terminal window provided by the OS (I'm on MX-Linux 23-2 "Libretto" and I have konsole, xterm, and gnome-console available? 2. Is it possible to get it to not show the control characters? 3. Are the control characters coming from the USES Crt thing combining with Writeln? I'm using debian bookworm's main packages - fpc 3.2.2+dfsg-20 and lazarus 2.2.6+dfsg2-2... Thanks, Will ---------------------------------------------------------------------- Martin_fr · 2024-02-04 23:31 At the moment there is no convenient way to output to a terminal.... There may be 2 ways, but I have tested neither, and they are well... workarounds 1) Use the "gdb server" debugger. Then you can open a shell of your choice, and run your app under gdbserver. You must start that by hand, the IDE will not do it for you. gdb server will pause your project, the IDE can connect to it, and you can debug. 2) using the gdb debugger, in the settings for the gdb debugger is a property grid. It has some setting for a "pty" (I don't have my Linux running now, so not sure of the exact details). If you have a terminal open, and print that terminals pty, then you can enter it here, and your app will connect to it. But if you do input, it will be shared with the shell.... So neither of those 2 is really good. On Mac the LLDB debugger can open a terminal, not sure if it can on Linux. EDIT: the internal tty may even exist for fpdebug (not sure, currently on Windows) ---------------------------------------------------------------------- decuser · 2024-02-04 23:38 Well, it's not the end of the world. I'm only using it for simple pascal anyway. I can live with it and when I really want a terminal, I can just open one and run the app there. I appreciate the workarounds. I'll try them out as time and energy permit. I have confirmed that it's the same situation w/3.0. ---------------------------------------------------------------------- cdbc · 2024-02-04 23:47 Hi I do it in one of two ways: 1) I have a konsole(or xterminal) window running on another 'desktop' and     run my app there to test/see final result. 2) In 'View' -> 'Debug Windows' -> 'Console In/Output', there's an ide-window     that opens and lets you debug / interact with console. Remember to click on     it to get focus if you have a 'readln' or so...     You probably get a lot of escape-codes, but it's doable to debug this way... Regards Benny ---------------------------------------------------------------------- new2thisagain395 · 2024-03-23 13:36 Is there some way to configure that window so it's a little more visually appealing and get rid of the escape codes?  As noted it is workable but it's certainly not great. ---------------------------------------------------------------------- cdbc · 2024-03-23 13:42 Hi "uses Crt;" => Escape-codes!!! Sorry mate, no. edit: On the other hand, I don't think that @Warfley's brilliant library: https://github.com/Warfley/LazTextForms is quite so strung up on escape codes as the crt-unit. It uses a lot of them, sure, but in more appropriate doses, so to speak  It is certainly worth a 'Looksee'  The Crt-unit switches the console in 'Raw' mode on unit-startup, whereas Warfley's does it on a per function basis... Regards Benny ---------------------------------------------------------------------- new2thisagain395 · 2024-03-23 14:28 Understood.  When I run this app on Windows I get a nice clean console window. I'm wondering if I should instead create this as a simple windowed app with just a scrolling window, to achieve the same effect regardless of OS. ---------------------------------------------------------------------- cdbc · 2024-03-23 15:13 Hi If you just want basic scrolling text, with NO positioning and colors, then just leave the 'Crt' -unit out of your app altogether... No worries  Regards Benny ---------------------------------------------------------------------- new2thisagain395 · 2024-03-23 23:21 Actually I will be running this on a Raspberry pi so I'll need it to look like a dumb terminal display (the way the console appears on Windows is perfect). So I'm wondering if there a simple windowed type of Lazarus project that will mimic the windows console (simple ever-scrolling text)? ---------------------------------------------------------------------- cdbc · 2024-03-23 23:55 Hi Try this: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 EatAtJoes; var  I: integer; begin  for I:= 0 to 4 do Writeln;  Writeln(#9,'Eat at Joe''s!');  for I:= 0 to 1 do Writeln;  Writeln(#9,'Ten Million Flies Can''t ALL be wrong!');  Readln;end. it should look like the other, but free from escape-codes  If you don't _really_ need it, stear clear off "Crt" unit...  Regards Benny ---------------------------------------------------------------------- TRon · 2024-03-24 10:07 Quote from: decuser on February 04, 2024, 11:53:21 pm1. Is it possible to get the output to go to a terminal window provided by the OS (I'm on MX-Linux 23-2 "Libretto" and I have konsole, xterm, and gnome- console available? Yes. see picture (open project, menu run, then run parameters) but note that it depends on your Linux distro. If you know how to properly invoke your terminal emulator then simply replace with what your distro requires/needs. Quote2. Is it possible to get it to not show the control characters? No idea, I never use unit crt. Quote3. Are the control characters coming from the USES Crt thing combining with Writeln? Probably. ---------------------------------------------------------------------- decuser · 2024-03-31 15:26 Great answers all. The run parameters change was the best suggestion, as it just worked, but getting rid of CRT was informative and useful information that I will take to heart. ---------------------------------------------------------------------- Thaddy · 2024-03-31 17:25 Try this. also better cross platform;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 EatAtJoes;uses ptcCrt; begin  ClrScr;  GotoXY(10,5);  Writeln('Eat at Joe''s!');  GotoXY(10,7);  Writeln('Ten Million Flies Can''t ALL be wrong!');  Readln;end.you do not need to install anything, it is also in the standard distribution.