say i have a string called "org_string"
org_string = "REFRACTIVE LIGHT";
i also have a string array called keys[6];
keys has 6 elements(obviously) and right now all of those elements are equal to the null terminator "\0"
can somebody write me a function that splits org_string into the two words separated by spaces within it and place the words in separate elements of keys[];
i.e.
There are many ways to split strings in c++, this question asking the same thing on SO, has so many replies so you really have no excuse for not having a way to split strings in c++. Even the string library has a split method. http://stackoverflow.com/questions/236129/how-to-split-a-string-in-c
@OP: By default, C++ strings are empty. Lines 14-17 assign one character to the strings, so the strings are not empty but instead contain the null character, giving them a length of 1 and not 0.