<!--
{
  "availability" : [
    "iOS: 2.0.0 - 8.0.0",
    "iPadOS: 2.0.0 - 8.0.0",
    "macCatalyst: 13.1.0 - 13.1.0",
    "macOS: 10.2.0 - 10.10.0",
    "tvOS: 9.0.0 - 9.0.0",
    "visionOS: 1.0.0 - 1.0.0",
    "watchOS: 2.0.0 - 2.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CFPropertyListWriteToStream(_:_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@F@CFPropertyListWriteToStream"
  },
  "title" : "CFPropertyListWriteToStream(_:_:_:_:)"
}
-->

# CFPropertyListWriteToStream(_:_:_:_:)

Writes the bytes of a property list serialization out to a stream.

```
func CFPropertyListWriteToStream(_ propertyList: CFPropertyList!, _ stream: CFWriteStream!, _ format: CFPropertyListFormat, _ errorString: UnsafeMutablePointer<Unmanaged<CFString>?>!) -> CFIndex
```

## Parameters

`propertyList`

The property list to write out.

`stream`

The stream to write to. The stream must be opened and configured—this function simply writes bytes to the stream.

`format`

A constant that specifies the format used to write `propertyList`. See [`CFPropertyListFormat`](/documentation/CoreFoundation/CFPropertyListFormat) for possible values.

`errorString`

On return, `NULL` if the conversion is successful, otherwise a string that describes the nature of the errors. Error messages are not localized, but may be in the future, so they are not currently suitable for comparison.

    Pass     `NULL`     if you do not wish to receive an error string. Ownership follows the     [The Create Rule](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html#//apple_ref/doc/uid/20001148-103029)    .

## Return Value

The number of bytes written, or `0` if an error occurred. If `0` is returned, `errorString` will contain an error message.

## Discussion

This function leaves the stream open after reading the content. When reading a property list, this function expects the reading stream to end wherever the writing ended, so that the end of the property list data can be identified.

### Special Considerations

> Warning:
> This function is obsolete and will be deprecated soon. Use ``doc://com.apple.corefoundation/documentation/CoreFoundation/CFPropertyListWrite(_:_:_:_:_:)`` instead.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)