swirl
Guide to OmniMark 7   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
      Other Library Functions  
function  

vfsOpen

 
 

Library: File system utilities (OMVFS) legacy
Include: omvfs.xin
Return type: vfsFile
Returns: 

A vfsFile object for the opened file.


Declaration

  define external vfsFile function vfsOpen
         value  stream   file-path
    for  value  integer  access-type  optional

  or

  define external vfsFile function vfsOpen
         value  stream   absolute-URL
    for  value  integer  access-type  optional

  or

  define external vfsFile function vfsOpen
         value  stream   relative-URL
     on  value  vfsDir   dir
    for  value  integer  access-type  optional

Argument definitions

file-path
is the file to be opened expressed in local file system format.
absolute-URL
is the file to be opened expressed as an absolute URL.
relative-URL
is the file to be opened expressed as a relative URL using the specified vfsDir object as its base.
dir
is a vfsDir object created by connecting to a network resource using either vfsConnect or vfsConnectDir.
access-type
is the desired mode of access. The default value is VFS-READ.


Purpose

Use vfsOpen to open a file. A vfsFile OMX component is returned.

Requirements

You must include the following line at the beginning of your OmniMark program:

  include "omvfs.xin"

file-path must be expressed in local file system format, either as an absolute path, or relative to the current working directory.

absolute-URL must be expressed as an absolute URL.

relative-URL must be expressed as a relative URL based on the current working directory for the vfsDir object dir (else external exception VFS105).

The vfsDir object dir must:

access-type is an optional parameter which defaults to VFS-READ. If it is supplied, it must have one of the following values:

Specifying any other value for access-type will cause an exception to be thrown (external exception VFS201).

If the access-type is VFS-READ, the file must exist (else external exception VFS306).

Usage Notes

If an existing file is opened with an access-type of VFS-WRITE, then its contents are deleted.

External exception VFS300 is thrown for any general OS operation failure. The text accompanying the exception will contain details on the reason for the failure.

External exception VFS111 is thrown if an URL supplied as a parameter to this function contains invalid encoding.

External exception VFS004 is thrown if the URL exceeds system length limits.

For complete details on absolute URLs and valid encoding, see Internet Standards RFC 1738: Uniform Resource Locators.

For complete details on relative URLs, see Internet Standards RFC 1808: Relative Uniform Resource Locators.

Example

Opening a file in a subdirectory of the current directory with read-only access.

  include "omvfs.xin"

  process
    local vfsFile myFile
    	. . .
    set myFile to vfsOpen "programs/myscript.xom"
    	for vfs-read

        Other Library Functions
   vfsChangeDir
   vfsChangeOwner
   vfsChangePermissions
   vfsClose
   vfsConnect
   vfsConnectDir
   vfsCopy
   vfsCursorPosition
   vfsDeleteDir
   vfsDeleteFile
   vfsDescribe
   vfsDescribeFile
   vfsDir
   vfsDirName
   vfsDisconnect
   vfsFile
   vfsFileDir
   vfsFileName
   vfsIsVersionCompatible
   vfsLibraryVersion
   vfsLink
   vfsList
   vfsLock
   vfsMakeDir
   vfsMove
   vfsMoveCursor
   vfsOpen
   vfsRead
   vfsRename
   vfsTruncate
   vfsUnlock
   vfsWrite
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACYLIBRARIES ] [ ERRORS ]

OmniMark 7.1.2 Documentation Generated: June 28, 2005 at 5:46:05 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © Stilo Corporation, 1988-2005.