IFileIOStream

Standard-library-style stream class which can be construced from an IFile.

This class allows iostream-based code to interoperate with the OpenClass file system API. IFileIOStream class consists mostly of constructors and open/close member functions. To perform I/O operations, use the member functions inherited from iostream.


IFileIOStream - Member Functions and Data by Group

Constructors & Destructor


[view class]
~IFileIOStream
public:
virtual ~IFileIOStream()
Destructor If the stream is still open, the destructor attempts to close it. However, it does not throw an exception if the close fails.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
IFileIOStream
Constructs a stream from an IFile object.


Overload 1
public:
IFileIOStream( const IFile& fileToOpen, int modeForMe = ios::in + ios::out, int modeForOthers = 0 )

fileToOpen
The file to be opened for streaming.

modeForMe
The mode in which the file should be opened. Values for this parameter are formed by ORing together constants from the ios::open_mode enum. The following values are useful:
  • ios::in - Opens the file for reading.
  • ios::out - Opens the file for writing.
  • ios::app - Append mode - seeks to end before all writes.
  • ios::ate - At end - seeks to the end just after opening.
  • ios::binary - Performs i/o in binary mode rather than text.
  • ios::trunc - Truncates an existing file to 0 length when opening.

modeForOthers
Specifies the modes in which you want to allow others to open the file concurrently with you. This is formed by ORing values from ios::open_mode. Only the following are useful:
  • 0 - Others are not allowed to read or write.
  • ios::in - Others may read the file.
  • ios::out - Others may write to the file.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
public:
IFileIOStream( const IHostPathName& path, int modeForMe = ios::in + ios::out, int modeForOthers = 0, const ICompoundNameParser& = IFile::defaultParser ( ) )

path
A host-specific path name to the file which should be opened.

parser
The path name parser which should be used to parse the host-specific path. If none is specified, the default parser for the current system is used.

modeForMe
The mode in which the file should be opened. Values for this parameter are formed by ORing together constants from the ios::open_mode enum. The following values are useful:
  • ios::in - Opens the file for reading.
  • ios::out - Opens the file for writing.
  • ios::app - Append mode - seeks to end before all writes.
  • ios::ate - At end - seeks to the end just after opening.
  • ios::binary - Performs i/o in binary mode rather than text.
  • ios::trunc - Truncates an existing file to 0 length when opening.

modeForOthers
Specifies the modes in which you want to allow others to open the file concurrently with you. This is formed by ORing values from ios::open_mode. Only the following are useful:
  • 0 - Others are not allowed to read or write.
  • ios::in - Others may read the file.
  • ios::out - Others may write to the file.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Access Member Functions


[view class]
close
public:
void close()
Closes the stream if it is open. Unlike the destructor, this member function does throw an exception if it fails.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
file
public:
IFile file() const
Returns the file to which this stream is attached.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
open
public:
void open( const IFile& fileToOpen, int modeForMe = ios::in + ios::out, int modeForOthers = 0 )
Attaches the stream to another file. If the stream is already open, it closes current file first.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


IFileIOStream - Inherited Member Functions and Data

Inherited Public Functions

Inherited Public Data

Inherited Protected Functions

Inherited Protected Data