---
title: "string(withFileSystemRepresentation:length:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/filemanager/string(withfilesystemrepresentation:length:)"
---

# string(withFileSystemRepresentation:length:)

Returns an NSString object whose contents are derived from the specified C-string path.

## Declaration

```swift
func string(withFileSystemRepresentation str: UnsafePointer<CChar>, length len: Int) -> String
```

## Parameters

- `str`: A C string representation of a pathname.
- `len`: The number of characters in string.

## Return Value

Return Value An NSString object converted from the C-string representation string with length len of a pathname in the current file system.

## Discussion

Discussion Use this method if your code receives paths as C strings from system routines.

## See Also

### Converting file paths to strings

- [fileSystemRepresentation(withPath:)](foundation/filemanager/filesystemrepresentation(withpath:).md)
