I currently have a string delimited with pipes:
i.e. : pMsg = str1|str2|str3|str4

This string is tokenized using strtok. As long as all the strings are not empty, this works fine. After strtok is complete, I have the following:

token1 = str1
token2 = str2
token3 = str3
token4 = str4

BUT, I want to make it so I can have an empty string as one of the tokens in the string.
i.e. : pMsg = |str2|str3|str4

strtok seems to skip over the first pipe in this instance and assigns str2 to token1. Everything is getting bumped up one spot.

token1 = str2
token2 = str3
token3 = str4
token4 =

My goal is to still read token1 in as an empty string, and thus resulting in the following:

token1 =
token2 = str2
token3 = str3
token4 = str4


Any ideas????????