Question

I want to write and build and execute a Pascal Program in Notepad ++. If i execute the program in cmd the output is normal, but in the console in nppexec the output is empty

My Code:

Program Edgar;
Uses Crt;
Var cnt, tip, pot : INTEGER;   
Begin
  TextColor(Red);
  WriteLn('Hallo');
  tip := -1;
  cnt := 0;
  Randomize;
  pot := Random(2501)*10;
  WriteLn(pot);
  WHILE (tip <> pot) do
    Begin
    WriteLn('Tip: ');
    ReadLn(tip);
    if (tip < pot) then begin
      WriteLn('Too low');
      cnt := cnt + 1
    end;
    if (tip > pot) then begin
      WriteLn('Too High');
      cnt := cnt + 1
    end;
  end;
  cnt:= cnt + 1;
  WriteLn('IA IA');
  WriteLn('Tries: ',cnt );
End.

Build Commands:

cd $(CURRENT_DIRECTORY)
fpc $(NAME_PART).pas
$(NAME_PART).exe

Output(Nppexec):

Free Pascal Compiler version 2.6.2 [2013/02/12]
for i386 Copyright (c) 1993-2012 by Florian Klaempfl
and others Target OS: Win32 for i386 
Compiling ue23.pas 
Linking ue23.exe 27 lines compiled, 0.1 sec , 33536 bytes code, 1900 bytes data
<<< Process finished. 
(Exit code 0) 
ue23.exe Process started >>>
Was it helpful?

Solution

If you enable unit CRT, the application will write to the console directly (using *console winapi functions) instead of using stdout.

Probably the console screen of npp is not a real console screen, but a capture of stdout (-piped) only.

Except not using crt (and thus not using cursor movement and coloring) there is not much that can be done, this is probably a NPP limitation.

OTHER TIPS

After that, you need to press "Enter" while your cursor blinking in output side.

And you will get the output with these lines at the end.

<<< Process finished. (Exit code 0)
================ READY ================

There is no limitation, you can run commands from that output side of notepad++.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top