REBOL Programming/read

From Wikibooks, open books for an open world
Jump to: navigation, search

USAGE:[edit]

READ source /binary /string /direct /no-wait /lines /part size /with end-of-line /mode args /custom params /skip length 

DESCRIPTION:[edit]

Reads from a file, url, or port-spec (block or object).

READ is a native value.

ARGUMENTS[edit]

  • source -- (Type: file url object block)

REFINEMENTS[edit]

  • /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 -- (Type: number)
  • /with -- Specifies alternate line termination.
    • end-of-line -- (Type: char string)
  • /mode -- Block of above refinements.
    • args -- (Type: block)
  • /custom -- Allows special refinements.
    • params -- (Type: block)
  • /skip -- Skips a number of bytes.
    • length -- (Type: number)

SOURCE CODE[edit]

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!]
]