tags:

views:

29

answers:

1

I have to merge two data objects and later separate them.Can anybody suggest me the way to go about it.It's urgent!!!!!! please respond fast.... Thanks

A: 

Have a look at NSMutableData. Specifically, look at the appendData: and appendBytes:Length methods.

You can 'merge' two NSData objects by appending them to an empty NSMutableData object. You can then probably retrieve the data using getBytes:range: and reconstruct your NSData object with dataWithBytes:Length:.

Have a look at this article for working with mutable binary data (includes sample code).

Nebs
i tried that but i dont know the length of my NSData object
Ajayvictor007
Have you tried NSData's 'length' property?
Nebs