contentsconceptssyntaxlibrariessampleserrorsindex
Full text search
action   open    
Sample Code   Related Syntax   Related Concepts  

Syntax

  open stream-name indexer? open-modifiers? as attachment


Purpose

Setting a stream to open allows it to be written to and causes previous contents to be lost, just as though the stream had been discarded.

A stream can be opened if it is:

The permitted attachments are:

Open modifiers are modifiers that affect how the stream is opened. If more than one open modifier is specified, they must be enclosed in parentheses and separated by "&". Each modifier can be specified only once. The modifiers are:

(Note that for backward compatibility, OmniMark allows the file keyword to be omitted from the file attachment. This practice is deprecated in versions of OmniMark later than V3.)

  local stream x
  ...
  open x as binary-mode file "y"
  open x as file binary-mode file "y"
  open x with binary-mode as file "y"

This code fragment includes three different open...as file statements. The first two are equivalent, though the second is the more efficient form of the statement. The third action is different.

In the first action, note that binary-mode file "y" is a string expression, whose value is the content of the binary file named "y". This is the deprecated form of "open...as file" (with the keyword file omitted), so that x is opened as a file whose name is contained in the binary file "y". On systems where text-mode is the default, x will be opened in text mode; on other systems, it will be opened in binary mode.

The second action is a slightly clearer way of doing the same thing as the first action. You are strongly encouraged to use this second form instead of the first.

The third action opens x in binary mode with the name "y".

Sample Code  
   Referents and line breaking
 
Related Syntax
   file
   reopen
 
Related Concepts
   I/O and variables
   Output
   Referent set nesting depth
   Referents: default definitions for a reopened stream
   Referents: writing data to a referent in a piecemeal fashion
   Referents: writing referents to a stream
   Security considerations
   Streams: open streams in local scopes
   Streams: reopening
 
----

Top [CONTENTS] [CONCEPTS] [SYNTAX] [LIBRARIES] [SAMPLES] [ERRORS] [INDEX]

Generated: April 21, 1999 at 2:01:13 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © OmniMark Technologies Corporation, 1988-1999.