---
title: withCStringNoCopy
framework: driverkit
role: symbol
role_heading: Static Method
path: driverkit/osstring/withcstringnocopy
---

# withCStringNoCopy

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

## Declaration

```occ
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

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

## Discussion

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

## See Also

### Creating a String

- [withString](driverkit/osstring/withstring.md)
- [withCString](driverkit/osstring/withcstring-4wsql.md)
- [withCString](driverkit/osstring/withcstring-721oh.md)
- [OSStringCreate](driverkit/osstringcreate.md)
- [free](driverkit/osstring/free.md)
