2013-10-21 37 views
2

我想在Notepad ++中編寫和構建並執行Pascal程序。如果我在cmd中輸出正常執行程序,但在nppexec輸出控制檯是空NPPExec中沒有Pascal輸出

我的代碼:

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 >>> 

回答

3

如果啓用單位CRT,應用程序將直接寫入控制檯(使用* conso le winapi函數)而不是使用stdout。

npp的控制檯屏幕可能不是真正的控制檯屏幕,而是僅捕獲stdout(-piped)。

除了不使用crt(因此不使用光標移動和着色),沒有太多可以完成的工作,這可能是一個NPP限制。

-1

之後,您需要在光標在輸出端閃爍時按下「Enter」鍵。

你會在最後得到帶有這些行的輸出。

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

沒有限制,您可以從notepad ++的輸出端運行命令。