Concole model programming lazarus / 21-General ---------------------------------------------------------------------- Andrew1020 · 2025-06-10 08:32 let's put it this way.  I have been away from Pascal programming since 1996. Can you suggest how should I go about with Pascal console programming, without the Lazarus IDE adding in "commands" into the code editor.  I just want to do some console programming, before I go on to do basic object-oriented programming leading into GUI programming later on. My intention is to use Free Pascal in Lazarus for a number of experimentation activities. Moderator notice: email hidden, to avoid harvesting by bots Please use PM to exchange contact info ---------------------------------------------------------------------- cdbc · 2025-06-10 08:47 Hi In lazarus: Menu -> project -> new project -> program -> [OK] Now lazarus has started a blank console program-skeleton for you, without any GUI Chicky-Micky at all. To view the output when debugging: Menu -> View -> Debug Windows -> Console in/output HTH Regards Benny ---------------------------------------------------------------------- Thaddy · 2025-06-10 11:20 Don't forget to add a readln at the end of your console program.... Lazarus behaves rather silly otherwise. As opposed to e.g. Geany. You won't be able to see your console output otherwise. (and I still think after all those years it would be fixed) ---------------------------------------------------------------------- TBMan · 2025-06-10 13:30 Quote from: Andrew1020 on June 10, 2025, 10:32:34 amlet's put it this way.  I have been away from Pascal programming since 1996. Can you suggest how should I go about with Pascal console programming, without the Lazarus IDE adding in "commands" into the code editor.  I just want to do some console programming, before I go on to do basic object-oriented programming leading into GUI programming later on. My intention is to use Free Pascal in Lazarus for a number of experimentation activities. Please reply to me at andrewgoh2032@yahoo.com  Thanks. I did about the same thing as you. I stopped coding around the turn of the century. When I returned a year or two ago I started back with my Borland Compiler running in DOSBOX (I had transferred the compiler from computer to computer for 30 years, "just in case"). DOSBOX was/is a bit wonky and luckily for me I found Lazarus. If you are going to code your own GUI there is PTCGraph, PTCcrt and PTCMouse. PTCGraph and PTCCrt and almost perfect replacements for Borland/Turbo Pascal's graph and crt units. ---------------------------------------------------------------------- Zvoni · 2025-06-10 13:54 .... and remove your EMail-Address from your first post.... ---------------------------------------------------------------------- Andrew1020 · 2025-06-11 12:54 I followed the steps right down to console input/output.  But Lazarus doesn't show the output of a simple console program.  Any workarounds.  Basically I am tempted to try Delphi 12 CE. ---------------------------------------------------------------------- Thaddy · 2025-06-11 13:05 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 {$mode objfpc}{$apptype console}// <----- if you are on windows onlybegin  writeln('hello, whatever');  readln; // <----- if you are on windows onlyend. Should always work. ---------------------------------------------------------------------- TBMan · 2025-06-11 15:17 I use the "Simple Program" selection when creating a new program. Here is a video I made which is essentially the same as Thaddy posted, but starts at the empty project screen. https://youtu.be/urt1RtXvz90 ---------------------------------------------------------------------- mika · 2025-06-11 21:58 For console programing there is Fp shipped with fpc. It is way simpler than Lazarus. With knowledge from year 1996, you will be all set and good. In development branch are a lot fixes and updates to fp. For better experience I suggest to try out that version.  If happen that you use Linux then xterm with custom configuration is a must (Shift+Ins, colors, fonts, copy/paste to OS... ). ---------------------------------------------------------------------- Andrew1020 · 2025-06-12 03:54 Can't the console mode from FPC be build into Lazarus, so that simple mode program can be run in Lazarus, as a major upgrade. ---------------------------------------------------------------------- Thaddy · 2025-06-12 04:10 You can do console programming in the Lazarus IDE. What makes you think otherwise? Save my example above as hello.lpr and (re-)open it. The trick is for  windows is {$apptype console} and the readln at the end. {$apptype console} sets up input, output and erroutput. for the console. (a.k.a. stdin/stdout/stderr) The readln at the end is to pause the program so the output is actually shown. ---------------------------------------------------------------------- TBMan · 2025-06-12 05:33 Quote from: Andrew1020 on June 12, 2025, 05:54:43 amCan't the console mode from FPC be build into Lazarus, so that simple mode program can be run in Lazarus, as a major upgrade. Try reading my previous post and actually watch the video. People are giving you the answers and you are ignoring them. ---------------------------------------------------------------------- cdbc · 2025-06-12 06:19 Hi Here's a 'live' screenshot of lazarus doing exactly what you want, from just a minute ago...  Follow mine, @Thaddy & TbMan's advice and you are good to go... Regards Benny eta: Ohh and this was done in Linux -- remember Thaddy's advice! ---------------------------------------------------------------------- mika · 2025-06-12 07:30 Quote from: TBMan on June 12, 2025, 07:33:32 amTry reading my previous post and actually watch the video. People are giving you the answers and you are ignoring them. That is not experience that average Joe is having. I am on Linux, but it is not that much different from windows experience. Lets go least resistance path. 1. Download fpcupdeluxe-x86_64-linux. 2. Select FPC version: Stable, Lazarus version: Stable. 3. Install FPC+Lazarus. 4. Run Lazarus (version 3.6 for some reason). 5. Start New Simple project. 6. Enter "Hello world" program. 7. Run.   (Console does not show up, program is running somewhere hidden). 8. Enable: Menu -> View -> Debug Windows -> Console in/output 9. Run (with debug info). Now there is some sort of pseudo console visible with output (good for debugging GUI apps not doing console programing). To get console like in your provided video, one have to have prior knowledge how to setup Lazarus properly. ---------------------------------------------------------------------- Andrew1020 · 2025-06-12 07:36 How should I go about removing my email and lazarus account from the forum. ---------------------------------------------------------------------- cdbc · 2025-06-12 07:42 Hi No worries mate  @marcov did it for you  Regards Benny ---------------------------------------------------------------------- MarkMLl · 2025-06-12 07:47 Quote from: mika on June 12, 2025, 09:30:53 amThat is not experience that average Joe is having. I am on Linux, but it is not that much different from windows experience. Lets go least resistance path. OP isn't complaining about not being able to run FPC, FP, or Lazarus. Furthermore he's not told us anything about the OS etc. that he's using, so let's try to keep this general. I unequivocally echo what Thaddy et al. have said, with one caveat. Lazarus can run and debug non-interactive console-oriented programs with absolutely no problem. It can also run and debug interactive console-mode programs in its own "Console In/Output" window (unless this has been renamed recently), with the caveats that it doesn't know about escape sequences etc. and isn't very good at Unicode (i.e. multi-byte characters) due at least in part to the peculiarities of the underlying debuggers (again, this might have changed since I was last involved). /If/ you need the authentic console experience (with the usual caveats relating to OS etc.), then start the program from the shell and tell the Lazarus IDE to attach to it. In that way, you have at least most of the usual support for console-style escape sequences, function keys and so on. What you obviously /don't/ have is a character-addressable screen such as one would have used on a PC-DOS system. There's ways round that, but I'm not comfortable holding forth on them. MarkMLl ---------------------------------------------------------------------- TBMan · 2025-06-12 13:50 Quote from: mika on June 12, 2025, 09:30:53 amQuote from: TBMan on June 12, 2025, 07:33:32 amTry reading my previous post and actually watch the video. People are giving you the answers and you are ignoring them. That is not experience that average Joe is having. I am on Linux, but it is not that much different from windows experience. Lets go least resistance path. 1. Download fpcupdeluxe-x86_64-linux. 2. Select FPC version: Stable, Lazarus version: Stable. 3. Install FPC+Lazarus. 4. Run Lazarus (version 3.6 for some reason). 5. Start New Simple project. 6. Enter "Hello world" program. 7. Run.   (Console does not show up, program is running somewhere hidden). 8. Enable: Menu -> View -> Debug Windows -> Console in/output 9. Run (with debug info). Now there is some sort of pseudo console visible with output (good for debugging GUI apps not doing console programing). To get console like in your provided video, one have to have prior knowledge how to setup Lazarus properly. If the OP is using Windows, all you have to do is download and then install. Nothing else needs to be done. Using CRT or (PTCcrt) you can do whatever was done in Turbo Pascal text mode programming. I'm old school and use CRT, DOS, the Graph unit replacement, PTCGraph, which is excellent and there is also PTCMouse.