---
title: "withPlatformString(_:)"
framework: system
role: symbol
role_heading: Instance Method
path: "system/filepath/withplatformstring(_:)"
---

# withPlatformString(_:)

Calls the given closure with a pointer to the contents of the file path, represented as a null-terminated platform string.

## Declaration

```swift
func withPlatformString<Result>(_ body: (UnsafePointer<CInterop.PlatformChar>) throws -> Result) rethrows -> Result
```

## Parameters

- `body`: A closure with a pointer parameter that points to a null-terminated platform string. If body has a return value, that value is also used as the return value for this method.

## Return Value

Return Value The return value, if any, of the body closure parameter.

## Discussion

Discussion The pointer passed as an argument to body is valid only during the execution of this method. Don’t try to store the pointer for later use.
