Progress ABL 中 Java 的 System.out.println() 相当于什么?

问题描述 投票:0回答:1

我正在尝试在

System.out.println()
中实现 Java 的
Progress ABL
方法。

最接近的功能似乎是:

测试.p:

MESSAGE "hello world" SKIP.

我运行了以下测试来查看它是否有效:

Windows
FAIL    C:\opt\prgs\dlc117\bin\prowin   -b -p test.p
OK      C:\opt\prgs\dlc117\bin\prowin   -b -p test.p | % ToString
OK      C:\opt\prgs\dlc117\bin\_progres -b -p test.p
OK      C:\opt\prgs\dlc117\bin\_progres -b -p test.p | % ToString

Unix
TODO

所以最后我会这样实现:

METHOD STATIC PUBLIC VOID println(i_cText AS CHAR):

    MESSAGE i_cText SKIP.
    PAUSE 0.
    
    CATCH oError AS CLASS Progress.Lang.Error:
        /* Suppress error because MESSAGE doesn't support NO-ERROR. */
    END.
END.

我还没有找到一种方法来知道

MESSAGE
何时会失败。我尝试检查
OPSYS
TERMINAL
SESSION:BATCH-MODE
,但它们并不可靠。我需要知道
default output
是否存在,但是如何存在?

openedge progress-4gl println
1个回答
1
投票

AFIAK,您始终必须重定向才能批量执行。 没有重定向结果的命令行

---------------------------
Error
---------------------------
** Attempt to write with no current output destination. (516)
---------------------------

一旦重定向,下面的代码将写入标准输出。

put unformatted "put Hello world".
message "message Hello world".
display "display Hello world".
quit.

您可以在 Linux 上使用

| tee
或在 powershell 中使用
| % ToString
结果

prowin.exe -b -p .\helloworld_stdout.p | % ToString
put Hello world
message Hello world

display Hello world
© www.soinside.com 2019 - 2024. All rights reserved.