<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CFStringGetFileSystemRepresentation(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@F@CFStringGetFileSystemRepresentation"
  },
  "title" : "CFStringGetFileSystemRepresentation(_:_:_:)"
}
-->

# CFStringGetFileSystemRepresentation(_:_:_:)

Extracts the contents of a string as a `NULL`-terminated 8-bit string appropriate for passing to POSIX APIs.

```
func CFStringGetFileSystemRepresentation(_ string: CFString!, _ buffer: UnsafeMutablePointer<CChar>!, _ maxBufLen: CFIndex) -> Bool
```

## Parameters

`string`

The string to convert.

`buffer`

The C string buffer into which to copy the string. The buffer must be at least `maxBufLen` bytes in length. On return, the buffer contains the converted characters.

`maxBufLen`

The maximum length of the buffer.

## Return Value

`true` if the string is correctly converted; `false` if the conversion fails, or the results don’t fit into the buffer.

## Discussion

You can use [`CFStringGetMaximumSizeOfFileSystemRepresentation(_:)`](/documentation/CoreFoundation/CFStringGetMaximumSizeOfFileSystemRepresentation(_:)) if you want to make sure the buffer is of sufficient length.

---

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)