Jump to content

Rebol Programming/read

From Wikibooks, open books for an open world

USAGE:

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

DESCRIPTION:

[edit | edit source]

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

READ is a native value.

ARGUMENTS

[edit | edit source]
  • source -- (Type: file url object block)

REFINEMENTS

[edit | edit source]
  • /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 | edit source]
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!]
]