跳轉到內容

Rebol 程式設計/read

來自華夏公益教科書,開放的書籍,開放的世界
READ source /binary /string /direct /no-wait /lines /part size /with end-of-line /mode args /custom params /skip length 

從檔案、URL 或埠規範(塊或物件)讀取。

READ 是一個原生值。

  • -- (型別:檔案 URL 物件 塊)
  • /二進位制 -- 準確地保留內容。
  • /字串 -- 翻譯所有行終止符。
  • /直接 -- 在不緩衝的情況下開啟埠。
  • /無等待 -- 如果沒有資料,則立即返回而不等待。
  • /行 -- 將資料處理為行。
  • /部分 -- 讀取指定數量的資料。
    • 大小 -- (型別:數字)
  • /使用 -- 指定備用行終止符。
    • 行尾 -- (型別:字元 字串)
  • /模式 -- 上面細化的塊。
    • 引數 -- (型別:塊)
  • /自定義 -- 允許特殊細化。
    • 引數 -- (型別:塊)
  • /跳過 -- 跳過一定數量的位元組。
    • 長度 -- (型別:數字)

原始碼

[編輯 | 編輯原始碼]
read: native[
    {Reads from a file, url, or port-spec (block or object).} 
    source [file! url! object! block!] 
    /binary "Preserves contents exactly." 
    /string "Translates all line terminators." 
    /direct "Opens the port without buffering." 
    /no-wait "Returns immediately without waiting if no data." 
    /lines "Handles data as lines." 
    /part "Reads a specified amount of data." 
    size [number!] 
    /with "Specifies alternate line termination." 
    end-of-line [char! string!] 
    /mode "Block of above refinements." 
    args [block!] 
    /custom "Allows special refinements." 
    params [block!] 
    /skip "Skips a number of bytes." 
    length [number!]
]
華夏公益教科書