-
Notifications
You must be signed in to change notification settings - Fork 3
Words open
rgchris edited this page Aug 12, 2016
·
2 revisions
Opens a new port connection. Open is a native value.
- spec
- (Type: 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
- (Type: char string)
- /allow
- Specifies the protection attributes when created.
- access
- (Type: block)
- /mode
- Block of above refinements.
- args
- (Type: block)
- /custom
- Allows special refinements.
- params
- (Type: block)
- /skip
- Skips a number of bytes.
- length
- (Type: number)
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
port | Ports related. |
file | File related operations. |
close | Closes an open port connection. |
load | Loads a file, URL, or string. Binds words to global context. |
do | Evaluates a block, file, URL, function, word, or any other value. |
insert | Inserts a value into a series and returns the series after the insert. |
remove | Removes value(s) from a series and returns after the remove. |
read | Reads from a file, url, or port-spec (block or object). |
write | Writes to a file, url, or port-spec (block or object). |
query | Returns information about a file or URL. |
get-modes | Returns mode settings for a port. |
set-modes | Changes mode settings for a port. |