Skip navigation.
 
mlRe: Malloc and NSData
FROM : Pontus Ilbring
DATE : Sun Dec 19 14:22:29 2004

On 2004-12-19, at 13.03, Peter Karlsson wrote:

> Dear list!
>
> How do I copy the contents of a buffer (made with malloc) into a NSData
> object?


If you mean copy into an existing NSData object then the answer is that
you don't. NSData is immutable.

If you mean create a new NSData object with data from a buffer then try
initWithBytes:length:

Related mailsAuthorDate
mlMalloc and NSData Peter Karlsson Dec 19, 13:03
mlRe: Malloc and NSData ??? a.k.a. James C… Dec 19, 14:03
mlRe: Malloc and NSData Pontus Ilbring Dec 19, 14:22
mlRe: Malloc and NSData The Karl Adam Dec 20, 02:03
mlRe: Malloc and NSData Clark Cox Dec 20, 03:40