NSData *theInformationData = //some information data;
NSData *encryptedData = //some encrypted data;
NSMutableData *theMainFile = [NSMutableData dataWithBytes:&theInformationData length:sizeof(theInformationData)];
[theMainFile appendData:encryptedData];
Now if write theMainFile to a file and want to read it from some other code. How can I exctract theInformationData without knowing the length of it? Is the length of theInformationData store in someway in theMainFile?
NSData *theExtractedInformation = [NSData data];
[theMainFile getBytes:&theExtractedInformation length:<#(NSUInteger)#>];
It think I should use this function getBytes: length: but I dont know the length?
Can someone point me in a direction? I hope I dont need to save the length of the theInformationData somewhere seperated from the file. This would seem inconvenient.
Thanks in advance.