使用Pascal在NPPExec中无输出

用户547995

我想在记事本++中编写,构建和执行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 >>>
马可·范·德·沃特

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

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

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

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章