I'm trying to implement a string tokenizer using the strtok() function but I keep get the following error;

error C2440: 'initializing' : cannot convert from 'const char *' to 'char *'

when trying to compile the following code;


string myString = "string to be tokenized";
char *sp;

sp = strtok(myString.c_str(), " ");
while (sp)
{
cout << sp << endl;
sp = strtok(NULL, "");
}



Also I need to keep the input as a string object as that is how it's used throughout my application. Any ideas on how to resolve this.

Cheers

Kam