breaking up a string

What is the proper way to break up a string and get what you need out of it?

This is what I have...

I read a string in, say "blue 4 5".

What I want to be able to do is compare the first part of the string, blue, to blue. If they are equal, I need to read the last part, 4 5, in as a date. There is a lot more to this, but I am curious as to how to break up the string.

What I think I need to do is read the string in, blue 4 5.

Use a for loop to read the first 5 letters. Append those first 5 letters to a string, and compare that string to "blue ".

If they are equal, I use a for loop starting with index 6 and ending with 8, and read in the date. I then send that date to my queue.

You could use that to find the spaces in the string to separate it into individual substrings.

strspn() - Find the first substring.

You could use this to find a substring in another string. It all depends on what you are trying to do. It seems to me that your specific case could allow you to write your own string searching function, like you said, which would be fastest.