Function

CFWriteStreamOpen

Opens a stream for writing.

Declaration

Boolean CFWriteStreamOpen(CFWriteStreamRef stream);

Parameters

stream

The stream to open.

Return Value

true if stream was successfully opened, false otherwise. If stream is not in the kCFStreamStatusNotOpen state, this function returns false.

Discussion

Opening a stream causes it to reserve all the system resources it requires. If the stream can open in the background without blocking, this function always returns true. To learn when a background open operation completes, you can either schedule the stream into a run loop with CFWriteStreamScheduleWithRunLoop and wait for the stream’s client (set with CFWriteStreamSetClient) to be notified or you can poll the stream using CFWriteStreamGetStatus, waiting for a status of kCFStreamStatusOpen or kCFStreamStatusError.

See Also

Opening and Closing a Stream

CFWriteStreamClose

Closes a writable stream.