An Input/Output (I/O) file object provides the ability to access disk files and to create, edit, and delete these files. The I/O file object references the actual file on the disk and defines access permissions for the file. After you create the file object within MSG-IDE, use methods to create or delete the file and to manipulate its contents.
I/O file objects also give you the ability to read the contents of a directory. In this case, the I/O file object references the directory rather than a specific file. You can then use openDir() and readDir() to create an internal list of the files that exist within the directory and to access each file in the list. See the e-Biz Impact ODL Guide for more information on the file object methods.
Defining an I/O file object
Select Tools | IO File from the MSG-IDE menu bar. The I/O File Object window appears and I/O File now appears in the Classes list.
Select I/O File and click Add.
Click in the Object Name field and type a name for your I/O file object. The name cannot contain a period (.) or a space.
Click in the Associated File field and type the file name.
When the I/O file object references a file, this is the name of the file to access or to create.
When the I/O file object references a directory, this is the name of the directory to access.
If the file or directory is not in the current working drive or directory of the ODL application, include either the full or relative path to the file.
Use a forward slash in the path for both Windows and UNIX.
This field is limited to 255 bytes for the actual filename and 1024 bytes for the path to the file.
Choose one of the following I/O Options:
Read Only: The I/O file object can only read the file.
Write Only: The I/O file object can only write to the file.
Read and Write: The I/O file object can read and write to the file.
Select from the following Write Options:
Use these options to specify how the I/O file object writes to the file. These options are not available when Read Only is selected in the I/O Options box.
You can select only one option, or you can select Create with either the Append or Truncate option. In the latter case, the I/O file object creates the file only if it does not currently exist.
Append: select to append new data to the end of an existing file.
Truncate: select to delete the contents of an existing file before writing new data to the file.
Create: select to create the file. Select the Exclusive check box to not create the file if a file of the same name already exists in the location specified in the Associated File field. When set and the file already exists, the I/O file object returns an FEEXIST error.
Select from the following Create Permissions options:
These options are used only when the I/O file object creates a file; they do not affect the permissions set on existing files.
Owner: Select the choices in this column to specify permissions of the file owner. The file owner is the controller running the application.
Group: Select the choices in this column to specify permissions for other users in the owner’s group. The owner’s group is the group of the controller running the application.
Other: Select the choices in this column to specify the permissions for all other users.
Click the Binary I/O check box to open or transfer the I/O file object associated file in binary rather than text mode.
This option is useful only on Windows platforms.
Click the Non Blocking I/O check box to never block on a read or write when the file has an enforcement lock.
When another user has an enforcement lock (rather than an advisory lock) set on a file, if you try to read or write to that file, your application blocks on the read or write call until the other user unlocks the file.
This does not affect blocking on a lockFile() or lockSeg() method.
Click OK to build the I/O file object and return to the Browse dialog box.
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |