|
-
February 11th, 2002, 01:18 PM
#1
Compilation Error
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|