void getCommands(char * cstr,char * p,string *userInput,string Input)
{
     
     string currentCommand = "";
     strcpy (cstr, userInput.c_str());
     p = strtok (cstr," ");
       while (p!=NULL)
   {
    p=strtok(NULL," ");
    cout << p;
}

ERROR
`c_str' has not been declared
request for member of non-aggregate type before '(' token


I have #include <cstring>
WHY STILL DONT WORK!!!!!!!!!!!!!!!!!!!!! :(:(:(

try

#include <string>

string.c_str() is a method for a string, and has nothing to do with including the cstring

still dont work...

Edit:
NVM your problem isn't the c_str(), userInput is already char.

strcpy (cstr, userInput);

yeah, thank you

Edit:
NVM your problem isn't the c_str(), userInput is already char.

strcpy (cstr, userInput);

userInput is a string * which means you have to dereference it using the -> operator, so userInput->c_str() @OP You still will need to include <string> if you are using std::string in your code.

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.