I am reading a line through standard input using

string str;
getline(cin,str);

now if i want to use the str to tokenize it using strtok , it says str should be char*.
What should i do?

I did try using gets(where i can use str by defining it char*), but a warning pops up saying "gets is being used. It is not safe" when running the program. i do not want that.

str.c_str() returns a char* you can use

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.