跳轉到內容

Rebol 程式設計/open

來自華夏公益教科書,開放世界的開放書籍
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 -- 在不緩衝的情況下以搜尋模式開啟埠。
  • /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!]
]
華夏公益教科書