跳轉到內容

Rebol 程式設計/open-events

來自華夏公益教科書,開放的書籍,為開放的世界
OPEN spec /binary /string /direct /seek /new /read /write /no-wait /lines /with end-of-line /allow access /mode args /custom params /skip length 

開啟新的埠連線。

OPEN 是一個原生值。

  • spec -- (型別: 檔案 URL 埠 物件 塊)
  • /binary -- 保留內容完全相同。
  • /string -- 翻譯所有換行符。
  • /direct -- 開啟埠而不進行緩衝。
  • /seek -- 在不進行緩衝的情況下以 seek 模式開啟埠。
  • /new -- 建立一個檔案。(不需要已經存在)。
  • /read -- 僅讀。停用寫入操作。
  • /write -- 僅寫。停用讀取操作。
  • /no-wait -- 如果沒有資料,立即返回,不等待。
  • /lines -- 將資料處理為行。
  • /with -- 指定備用換行符。
    • end-of-line -- (型別: 字元 字串)
  • /allow -- 指定建立時的保護屬性。
    • access -- (型別: 塊)
  • /mode -- 上述細化的塊。
    • args -- (型別: 塊)
  • /custom -- 允許特殊細化。
    • params -- (型別: 塊)
  • /skip -- 跳過一定數量的位元組。
    • length -- (型別: 數字)

原始碼

[編輯 | 編輯原始碼]
open: native[
    "Opens a new port connection." 
    spec [file! url! port! object! block!] 
    /binary "Preserves contents exactly." 
    /string "Translates all line terminators." 
    /direct "Opens the port without buffering." 
    /seek "Opens port in seek mode without buffering." 
    /new "Creates a file. (Need not already exist.)" 
    /read "Read only. Disables write operations." 
    /write "Write only.  Disables read operations." 
    /no-wait "Returns immediately without waiting if no data." 
    /lines "Handles data as lines." 
    /with "Specifies alternate line termination." 
    end-of-line [char! string!] 
    /allow "Specifies the protection attributes when created." 
    access [block!] 
    /mode "Block of above refinements." 
    args [block!] 
    /custom "Allows special refinements." 
    params [block!] 
    /skip "Skips a number of bytes." 
    length [number!]
]
華夏公益教科書