multiple null terminated strings in single buffer in C

Viewed 1273

In need to craft a string with the following format and place it into a single buffer[1000]. Note that \x00 is the null terminator.

@/foo\x00ACTION=add\x00SUBSYSTEM=block\x00DEVPATH=/devices/platform/goldfish_mmc.0\x00MAJOR=command\x00MINOR=1\x00DEVTYPE=harder\x00PARTN=1

So in essence I need to pack following null terminated strings into a single buffer

@/foo  
ACTION=add  
SUBSYSTEM=block  
DEVPATH=/devices/platform/goldfish_mmc.0  
MAJOR=command  
MINOR=1  
DEVTYPE=harder  
PARTN=1  

How might I go about doing this?

3 Answers
Related