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

# CFStringGetPascalStringPtr(_:_:)

Quickly obtains a pointer to a Pascal buffer containing the characters of a string in a given encoding.

```
func CFStringGetPascalStringPtr(_ theString: CFString!, _ encoding: CFStringEncoding) -> ConstStringPtr!
```

## Parameters

`theString`

The string to examine.

`encoding`

The string encoding to which the character contents of `theString` should be converted.

## Return Value

A pointer to a Pascal string buffer or `NULL` if the internal storage of theString does not allow this to be returned efficiently.

## Discussion

This function either returns the requested pointer immediately, with no memory allocations and no copying, in constant time, or returns `NULL`. If the latter is returned, call an alternative function such as the [`CFStringGetPascalString(_:_:_:_:)`](/documentation/CoreFoundation/CFStringGetPascalString(_:_:_:_:)) function to extract the characters.

Whether or not this function returns a valid pointer or `NULL` depends on many factors, all of which depend on how the string was created and its properties. In addition, the function result might change between different releases and on different platforms. So do not count on receiving a non-`NULL` result from this function under any circumstances.

---

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)