libplist  2.7.0
API Documentation - Return to Homepage

◆ plist_from_memory()

PLIST_API plist_err_t plist_from_memory ( const char *  plist_data,
uint32_t  length,
plist_t plist,
plist_format_t format 
)

Import the plist_t structure from memory data.

This function will look at the first bytes of plist_data to determine if plist_data contains a binary, JSON, OpenStep, or XML plist and tries to parse the data in the appropriate format.

Note
This is just a convenience function and the format detection is very basic. It checks with plist_is_binary() if the data supposedly contains binary plist data, if not it checks if the first bytes have either '{' or '[' and assumes JSON format, and XML tags will result in parsing as XML, otherwise it will try to parse as OpenStep.
Parameters
plist_dataA pointer to the memory buffer containing plist data.
lengthLength of the buffer to read.
plistA pointer to the imported plist.
formatIf non-NULL, the plist_format_t value pointed to will be set to the parsed format.
Returns
PLIST_ERR_SUCCESS on success or a plist_err_t on failure