<!--
{
  "availability" : [
    "DriverKit: -",
    "iOS: -",
    "iPadOS: -",
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "DriverKit",
  "identifier" : "/documentation/DriverKit/OSString/withCStringNoCopy",
  "metadataVersion" : "0.1.0",
  "role" : "Static Method",
  "symbol" : {
    "kind" : "Static Method",
    "modules" : [
      "DriverKit"
    ],
    "preciseIdentifier" : "c:@S@OSString@F@withCStringNoCopy#*1C#S"
  },
  "title" : "withCStringNoCopy"
}
-->

# withCStringNoCopy

Allocates an OSString object with a copy of a c-string.

```
static OSStringPtr withCStringNoCopy(const char *cString);
```

## Parameters

`cString`

Pointer to null terminated c-string. The string will be copied at the time of the call.

## Return Value

NULL on failure, otherwise the allocated OSString with reference count 1 to be released by the caller.

## Discussion

Allocates an OSString object with a copy of a c-string. A synonym for OSString::withCString() for compatibility with kernel code.

---

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)