<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "System",
  "identifier" : "/documentation/System/Stat/init(_:relativeTo:flags:retryOnInterrupt:)-5rm1x",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "System"
    ],
    "preciseIdentifier" : "s:6System4StatV_10relativeTo5flags16retryOnInterruptACSPys4Int8VG_AA14FileDescriptorVAC5FlagsVSbtAA5ErrnoVYKcfc"
  },
  "title" : "init(_:relativeTo:flags:retryOnInterrupt:)"
}
-->

# init(_:relativeTo:flags:retryOnInterrupt:)

Creates a `Stat` struct from an `UnsafePointer<CChar>` path and `Flags`,
including a `FileDescriptor` to resolve a relative path.

```
init(_ path: UnsafePointer<CChar>, relativeTo fd: FileDescriptor, flags: Stat.Flags, retryOnInterrupt: Bool = true) throws(Errno)
```

## Discussion

If `path` is absolute (starts with a forward slash), then `fd` is ignored.
If `path` is relative, it is resolved against the directory given by `fd`.

The corresponding C function is `fstatat()`.

---

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)