   C++ console Looping Input problem
  Hello there, trying to write my own command prompt type thing for a console ftp program and im having troubles looping input. The first time it works great, the second time it does not completly parse the whole thing typed in. I do not want it to ignore white space so i use cin.getline.Example;>>diri get "dir" and everything runs fine(second iteration)>>diri get "di" and its an invalid typebool exit = false;while (!exit){cout << ">>";char cmd_[100];cin.getline( cmd_, 100 );vector<char*> arg;for (char* token = strtok(cmd_, " "); token != NULL; token = strtok(NULL, "/n"))arg.push_back( token );int cmd = ftp::getCMD( arg[0] );if ( cmd ){switch ( cmd ){case dir:RemoteDir(); break;case ldir:LocalDir();   break;case cd:if ( (int)arg.size() == 2 )ChangeRemoteDir( arg[1] );break;case lcd:if ( (int)arg.size() == 2 ) ChangeDir( arg[1] );break;case pwd:PrintWorkingDir();break;case lpwd:PrintWorkingRemoteDir();break;case put:break;case get:break;case type:break;case bye:exit = true;break;}}elsecout << "Invalid Command, Try /help for a list of commands" << endl;}
  Rewrite it using C++ strings, here's a split function instead of strtoksplit("foo,bar,baz", ","); -> { "foo", "bar", "baz" }split("dir foo", " "); -> { "dir", "foo" };DMLtypedef std::vector strings_t;strings_t split(const string& str, const string& separator){strings_t v;string::size_type i;string remaining = str;while( (i = remaining.find(separator)) != string::npos ) {v.push_back( remaining.substr(0, i) );remaining = remaining.substr(i+1);}v.push_back( remaining );return v;}   ;  typedef std::vector<std::string> strings_tie a vector of strings.   ;  Thanks for that portion, but its the get line thats messeing it up, the strtok it doing the jon it is supose to do, the get line it cutting it off. I've ran the debug and steped thro plenty of times before it gets to the strtok and i can see the cmd_ is not correctly parsed from the input.Thanks