Creating separte strings from one string

Apr 21, 2011 at 4:42am
My code reads from a file and stores them in strings. Say, I have a string and I want to break it down into separate strings on every white space character. For example, if string str1 contains the sentence "My name is Brock Lesnar". I want to create 5 separate strings holding "My", "name" and so on. Is that even doable? How about when you have a bunch of strings in an array and want to perform the same operation on that.
Last edited on Apr 21, 2011 at 4:43am
Apr 21, 2011 at 8:27am
use strtok () function..... pass whitespace as the delimiter ....
hope that works
Topic archived. No new replies allowed.