REBOL Document

Open - Function Summary


Summary:

Opens a new port connection.

Usage:

open spec

Arguments:

spec - The spec argument. (must be: file url port object block)

Refinements:

/binary - Preserves contents exactly.

/string - Translates all line terminators.

/direct - Opens the port 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 - The end-of-line argument. (must be: char string)

/allow - Specifies the protection attributes when created.

access - The access argument. (must be: block)

/mode - Block of above refinements.

args - The args argument. (must be: block)

/custom - Allows special refinements.

params - The params argument. (must be: block)

/skip - Skips a number of bytes.

length - The length argument. (must be: number)

Description:

Opens a port for I/O operations. The value returned from OPEN can be used to examine or modify the data associated with the port. The argument must be a fully-specified port specification, an abbreviated port specification such as a file path or URL, or a block which is executed to modify a copy of the default port specification.


    autos: open/new %autos.txt
    insert autos "Ford"
    insert tail autos " Chevy"
    close autos
    print read %autos.txt
    Ford Chevy

Related:

close - Closes an open port connection.
do - Evaluates a block, file, URL, function, word, or any other value.
get-modes - Returns mode settings for a port.
insert - Inserts a value into a series and returns the series after the insert.
load - Loads a file, URL, or string. Binds words to global context.
query - Returns information about a file or URL.
read - Reads from a file, url, or port-spec (block or object).
remove - Removes value(s) from a series and returns after the remove.
set-modes - Changes mode settings for a port.
write - Writes to a file, url, or port-spec (block or object).


<Back | Index | Next>

Copyright 2004 REBOL Technologies