---
title: "AEStreamWriteDesc(_:_:_:_:)"
framework: coreservices
role: symbol
role_heading: Function
path: coreservices/1450387-aestreamwritedesc
---

# AEStreamWriteDesc(_:_:_:_:)

Appends the data for a complete descriptor to an AEStreamRef.

## Declaration

```swift
func AEStreamWriteDesc(_ ref: AEStreamRef!, _ newType: DescType, _ data: UnsafeRawPointer!, _ length: Size) -> OSStatus
```

## Parameters

- `ref`: An doc://com.apple.documentation/documentation/coreservices/aestreamref containing the stream data.
- `newType`: A type code for the new AEDesc being added to the stream. See doc://com.apple.documentation/documentation/coreservices/desctype.
- `data`: A pointer to the block of memory containing the descriptor data. This routine copies the memory block immediately, so you do not need to retain it for the benefit of this routine.
- `length`: The number of bytes pointed to by the data parameter.

## Return Value

Return Value A result code. See Result Codes.

## Discussion

Discussion Use this routine to write the data for a descriptor to the stream. When using this routine, you must supply all of the descriptor data at once.  Do not use AEStreamOpenDesc(_:_:) and AEStreamCloseDesc(_:) with this routine to open and close the descriptor.

## See Also

### Creating Apple Event Structures Using Streams

- [AEStreamClose(_:_:)](coreservices/1449821-aestreamclose.md)
- [AEStreamCloseDesc(_:)](coreservices/1449272-aestreamclosedesc.md)
- [AEStreamCloseList(_:)](coreservices/1448185-aestreamcloselist.md)
- [AEStreamCloseRecord(_:)](coreservices/1449522-aestreamcloserecord.md)
- [AEStreamCreateEvent(_:_:_:_:_:_:_:)](coreservices/1446562-aestreamcreateevent.md)
- [AEStreamOpen()](coreservices/1447732-aestreamopen.md)
- [AEStreamOpenDesc(_:_:)](coreservices/1446544-aestreamopendesc.md)
- [AEStreamOpenEvent(_:)](coreservices/1445366-aestreamopenevent.md)
- [AEStreamOpenKeyDesc(_:_:_:)](coreservices/1442897-aestreamopenkeydesc.md)
- [AEStreamOpenList(_:)](coreservices/1448594-aestreamopenlist.md)
- [AEStreamOpenRecord(_:_:)](coreservices/1447141-aestreamopenrecord.md)
- [AEStreamOptionalParam(_:_:)](coreservices/1444481-aestreamoptionalparam.md)
- [AEStreamSetRecordType(_:_:)](coreservices/1447704-aestreamsetrecordtype.md)
- [AEStreamWriteAEDesc(_:_:)](coreservices/1448487-aestreamwriteaedesc.md)
- [AEStreamWriteData(_:_:_:)](coreservices/1442610-aestreamwritedata.md)
- [AEStreamWriteKey(_:_:)](coreservices/1448750-aestreamwritekey.md)
- [AEStreamWriteKeyDesc(_:_:_:_:_:)](coreservices/1442568-aestreamwritekeydesc.md)
