使用Pascal在NPPExec中没有输出

时间:2013-10-21 07:47:34

标签: console notepad++ freepascal nppexec

我想在Notepad ++中编写和构建并执行Pascal程序。如果我在cmd中执行程序输出正常,但在nppexec的控制台中输出为空

我的代码:

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.

构建命令:

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

输出(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 >>>

2 个答案:

答案 0 :(得分:3)

如果启用了单元CRT,应用程序将直接写入控制台(使用* console winapi函数),而不是使用stdout。

npp的控制台屏幕可能不是真正的控制台屏幕,而只是stdout(-piped)的捕获。

除了不使用crt(因此不使用光标移动和着色)之外,没有太多可以做的,这可能是NPP限制。

答案 1 :(得分:-1)

之后,您需要按&#34;输入&#34;当光标在输出端闪烁时。

最后你会得到这些行的输出。

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

没有限制,您可以从记事本++的输出端运行命令。