FS$Open_File
Open a file in a FS file.
FS$Open_File opens a file within the file system in an open FS file.
Format:
FS$Open_File context name result
Returns:
Returns a condition code.
Argument:
context
A pointer to the context value returned by FS_Open that indicates the FS file to affect.
name
The address of an SRB structure that points to the fully-qualified file name within the file system. This must be provided and cannot be null.
result
The address of an 8-byte integer which will receive the address of a UOS_File instance.
Description
Opens the specified file within the file system of the FS file associated with the context. The file is opened in read/write mode. The file must exist and an error is returned if it does not. No UOS_File instance is returned if there is an error. The returned file instance is an object instance with a CORBA-compliant VMT. The methods of this instance are as follows:
Prototype |
Description |
TUnified_Exception* Initialize() |
Initializes the object. |
TUnified_Exception* Terminate() |
Terminates the object. |
void Attach() |
Increments the reference count. |
bool Detach() |
Decrements the reference count. Returns true if the object is completed dereferenced. |
bool Is_Class( char* Name ) |
Returns true if the passed name matches the name of the class or one of its ancestors. |
int32 Interface_Version() |
Version of interface. |
int32 Facility_ID() |
Facility ID for object. |
int32 Facility_Version() |
Facility version for the object. |
TDebug_Interface* Debugger() |
Returns nil. |
TUnified_Exception* Last_Error() |
Returns last exception. |
void* Extension() |
Returns nil. |
constructor Create() |
Constructor for the object. |
destructor Destroy() |
Destructor for the object. |
TUnified_Exception* Set_Last_Error( TUnified_Exception* E ) |
Sets an exception. |
int32 Create_Stream( char* Name ) |
Creates an ancillary data stream with the specified name. Returns the stream index. |
void Delete_Stream( char* Name, int32 Index ) |
Deletes an ancillary data stream with either the specified name or index. |
char* Stream_Name( int43 Index ) |
Returns the name of the specified ancillary data stream. |
int32 Max_Stream() |
Returns the highest ancillary data stream index. |
int64 Read( int32 Stream, int64 Position, int64 Length, void* Buff, int43 Flags ) |
Reads the specified stream at the specified position for the specified length into the provided buffer. Returns the number of bytes actually read. |
int64 Write( int32 Stream, int64 Position, int64 Length, void* Buff, int43 Flags ) |
Writes the specified stream to the specified position for the specified length from the provided buffer. Returns the number of bytes actually written. |
int64 Get_Stream_Size( int32 Stream ) |
Returns the size, in bytes, of the ancillary data stream with the passed index. |
void Set_Stream_Size( int32 Stream, int64 Value ) |
Sets the specified ancillary data stream to the specified size, in bytes. |
bool Get_Contiguous() |
Returns true if the file is contiguous. |
void Set_Contiguous( bool Value ) |
Sets the file to contiguous/non-contiguous. |
int64 Get_File_Size() |
Returns the file's data size, in bytes. |
void Set_File_Size( int64 Value ) |
Sets the file's data size. |
bool Read_Only() |
Returns true if the file is set to read-only. |
bool Write_Only() |
Returns true if the file is set to write-only. |
int64 XSpaceAvail() |
Returns the maximum possible space available to the file, in bytes. This includes space on the store that could be used to extend the file. |
bool Is_Store() |
Returns true if the file is a store. This will always return true for a file in a FS file. |
char* Name() |
Returns the name of the file. |
int64 ID() |
Returns the internal File ID. |
int64 Last_Error_Code() |
Returns the error code for the last operation (0 = no error). |
int64 Owner() |
Returns the Owner ID. |
int64 ACL() |
Returns the ACL pointer. |
int64 Flags() |
Returns the file flags. |
These methods all use the C calling standard (stdcall). When finished with this object instance, be sure to call Detach(), which will free the instance when all other references to the object are released. Note that if the FS file is closed with FS$Close, the object is no longer valid.
Condition Codes Returned:
Code |
Meaning |
FS_INVCONT |
Specified context is not valid. |
FS_INVNAME |
Specified name is not valid. |
SS_NORMAL |
Successful completion. |
Other errors can be returned.