If I read the contents of the buffer into a string, how do i parse it in C?

lets say, I wish to parse a string in the following format:

store first 16 bits in an integer,
store next 32 bits in another integer,
store remaining string data as hex.