跳轉到內容

Rebol 程式設計/echo

來自華夏公益教科書,開放的書籍,開放的世界
ECHO target 

將控制檯輸出複製到檔案。

ECHO 是一個函式值。

  • 目標 -- (型別:檔案 無 邏輯)

(特殊屬性)

[編輯 | 編輯原始碼]
  • 捕獲

原始碼

[編輯 | 編輯原始碼]
echo: func [
    "Copies console output to a file." 
    [catch] 
    target [file! none! logic!]
][
    if port? system/ports/echo [
        close system/ports/echo 
        system/ports/echo: none
    ] 
    if target = true [target: %rebol-echo.txt] 
    if file? target [
        system/ports/echo: throw-on-error [open/write/new/direct target]
    ]
]
華夏公益教科書