<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.7.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "XPC",
  "identifier" : "/documentation/XPC/xpc_array_dup_fd(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "XPC"
    ],
    "preciseIdentifier" : "c:@F@xpc_array_dup_fd"
  },
  "title" : "xpc_array_dup_fd(_:_:)"
}
-->

# xpc_array_dup_fd(_:_:)

Gets a file descriptor from an array directly.

```
func xpc_array_dup_fd(_ xarray: xpc_object_t, _ index: Int) -> Int32
```

## Parameters

`xarray`

The array which is to be examined.

`index`

The index of the value to obtain. This value must lie within the index space of the array (0 to N-1 inclusive, where N is the count of the array). If the index is outside that range, the behavior is undefined.

## Return Value

A new file descriptor created from the value at the specified index. You are responsible for closing this descriptor. `-1` if the value at the specified index is not a file descriptor value.

---

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)