<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSString/fileSystemRepresentation",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSString(py)fileSystemRepresentation"
  },
  "title" : "fileSystemRepresentation"
}
-->

# fileSystemRepresentation

A file system-specific representation of the receiver.

```
var fileSystemRepresentation: UnsafePointer<CChar> { get }
```

## Discussion

The returned C string will be automatically freed just as a returned object would be released; your code should copy the representation or use [`getFileSystemRepresentation(_:maxLength:)`](/documentation/Foundation/NSString/getFileSystemRepresentation(_:maxLength:)) if it needs to store the representation outside of the memory context in which the representation was created.

Raises an [`characterConversionException`](/documentation/Foundation/NSExceptionName/characterConversionException) if the receiver can’t be represented in the file system’s encoding. It also raises an exception if the receiver contains no characters.

Note that this method only works with file paths (not, for example, string representations of URLs).

To convert a `char *` path (such as you might get from a C library routine) to an `NSString` object, use the [`string(withFileSystemRepresentation:length:)`](/documentation/Foundation/FileManager/string(withFileSystemRepresentation:length:)) method on [`FileManager`](/documentation/Foundation/FileManager).

---

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)