Contents

withPlatformString(_:)

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

Declaration

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

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

Discussion

If the path has a relative portion, an allocation will occur in order to add the null terminator.

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.