<!--
{
  "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/FileType/init(rawValue:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "System"
    ],
    "preciseIdentifier" : "s:6System8FileTypeV8rawValueACs6UInt16V_tcfc"
  },
  "title" : "init(rawValue:)"
}
-->

# init(rawValue:)

Creates a strongly-typed file type from the raw C `mode_t`.

```
init(rawValue: CInterop.Mode)
```

## Discussion> Note: This initializer stores the `rawValue` directly and **does not**
> mask the value with `S_IFMT`. If the supplied `rawValue` contains bits
> outside of the `S_IFMT` mask, the resulting `FileType` will not compare
> equal to constants like `.directory` and `.symbolicLink`, which may
> be unexpected.
> 
> If you’re unsure whether the `mode_t` contains bits outside of `S_IFMT`,
> you can use `FileMode(rawValue:)` instead to get a strongly-typed
> `FileMode`, then call `.type` to get the properly masked `FileType`.

---

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)