【问题标题】:No Output in NPPExec with Pascal使用 Pascal 在 NPPExec 中没有输出
【发布时间】:2013-10-21 07:47:34
【问题描述】:

我想在 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 >>>

【问题讨论】:

    标签: console notepad++ freepascal nppexec


    【解决方案1】:

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

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

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

    【讨论】:

      【解决方案2】:

      之后,您需要在输出端的光标闪烁时按“Enter”。

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

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

      没有限制,你可以从notepad++的那个输出端运行命令。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-07-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-11-22
        • 1970-01-01
        • 2019-09-29
        • 1970-01-01
        相关资源
        最近更新 更多