That's what I'm saying - you need pointers to get it into the array:
// loop through and count the number of spaces:
int count = 0;
for (int i = 0; note[i]; i++)
{
if (note[i] == 0x20)
{
count++;
}
}
// declare a new array with that many items plus one
string *words = new string [count + 1];
int lastSpace = -1;
count = 0;
for (int i = 0; note[i]; i++)
{
if ((note[i] == 0x20))
{
*(words + count) = note.substr(lastSpace + 1, i - lastCount + 1);
count++;
}
}
*(words + count) = note.substr(lastSpace + 1, note.length()); That'll load 'em into an array (hopefully - it hasn't been tested).