Contents

CFWriteStreamCreateWithFile(_:_:)

Creates a writable stream for a file.

Declaration

func CFWriteStreamCreateWithFile(_ alloc: CFAllocator!, _ fileURL: CFURL!) -> CFWriteStream!

Parameters

  • alloc:

    The allocator to use to allocate memory for the new object. Pass NULL or kCFAllocatorDefault to use the current default allocator.

  • fileURL:

    The URL of the file to which to write. The URL must use a file scheme.

Return Value

The new write stream, or NULL on failure. Ownership follows the The Create Rule.

Discussion

The stream overwrites an existing file unless you set the kCFStreamPropertyAppendToFile to kCFBooleanTrue with CFWriteStreamSetProperty(_:_:_:), in which case the stream appends data to the file.

You must open the stream, using CFWriteStreamOpen(_:), before writing to it.

See Also

Creating a Write Stream