OpenDiskStream

Opens a disk stream for stream-oriented I/O.

Synopsis

Stream *OpenDiskStream( char *theName, int32 bSize )

Description

This routine allocates a new stream structure, opens the disk file identified by an absolute or relative pathname, allocates the specified amount of buffer space, and initiates an asynchronous read to fill the buffer with the first portion of the file's data. It returns NULL if any of these functions cannot be performed for any reason.

The bSize field specifies the amount of buffer space to be allocated to the file stream. It may be positive (giving the number of bytes to be allocated), zero (indicating that a default allocation of two blocks should be used), or negative (giving the two's complement of the number of blocks worth of memory that should be allocated).

Arguments

theName
An absolute or relative pathname (a null- terminated text string) for the file to open.
bSize
The size of the buffer to allocate for the stream. This can be (1) a positive value that specifies the size of the buffer to allocate, in bytes; (2) zero, which specifies to allocate the default buffer (currently two blocks); or (3) a negative value, the two's complement of which specifies the number of blocks of memory to allocate for the buffer.

Return Value

The function returns a pointer to the stream structure for the opened file or NULL if an error occurs.

Implementation

Folio call implemented in file folio V20.

Associated Files

filestreamfunctions.h

See Also

CloseDiskStream(), ReadDiskStream(), SeekDiskStream(), OpenDiskFile()