---
title: "CFFileDescriptorCreate(_:_:_:_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cffiledescriptorcreate(_:_:_:_:_:)"
---

# CFFileDescriptorCreate(_:_:_:_:_:)

Creates a new CFFileDescriptor.

## Declaration

```swift
func CFFileDescriptorCreate(_ allocator: CFAllocator!, _ fd: CFFileDescriptorNativeDescriptor, _ closeOnInvalidate: Bool, _ callout: CFFileDescriptorCallBack!, _ context: UnsafePointer<CFFileDescriptorContext>!) -> CFFileDescriptor!
```

## Parameters

- `allocator`: The allocator to use to allocate memory for the new file descriptor object. Pass NULL or kCFAllocatorDefault to use the current default allocator.
- `fd`: The file descriptor for the new CFFileDescriptor.
- `closeOnInvalidate`: true if the new CFFileDescriptor should close fd when it is invalidated, otherwise false.
- `callout`: The CFFileDescriptorCallBack for the new CFFileDescriptor.
- `context`: Contextual information for the new CFFileDescriptor.

## Return Value

Return Value A new CFFileDescriptor or NULL if there was a problem creating the object. Ownership follows the The Create Rule.

## See Also

### Related Documentation

- [CFFileDescriptorGetContext(_:_:)](corefoundation/cffiledescriptorgetcontext(_:_:).md)
- [CFFileDescriptorInvalidate(_:)](corefoundation/cffiledescriptorinvalidate(_:).md)
