Ok. So here is my problem.
I have a program that needs to take input in the form of:
"COMMAND VALUE"
What I need to do is store each part of the input string in to separate string variables. for the sake of argument I would call these inputA(COMMAND) and inputB(VALUE).
I have extensively looked at strtok(), and input stream solutions. Neither of which appear to be very elegant solutions. (for example strtok requires using char[] pointers?).
Which would even be the better solution for me? Performance isn't really an issue.
All I want is to cut the string in to two w/ a space delimiter. Surely there is a simple and clean solution to this?
#include <cstdlib>
#include <iostream>
#include <map> //stl map container
#include <string>
#include "queue.cpp" //queue class
#include "parse.h" //static class for parsing the commands.
int main(void)
{
//init input variables
std::string input="";
std::string Command="DEFAULT";
std::string Argument="DEFAULT";
//create associative array (stl map contianer) for user defined vars
std::map<std::string,std::string>variables;
while ( Command!="GO" ){
//echo out Command and Argument...TESTING
std::cout<<"Command: " <<Command <<std::endl;
std::cout<<"Argument: " <<Argument <<std::endl;
std::cout<<"Please enter a command: ";
std::cin>>input;
//parse the input in to 2 parts ( Command + Argument)
parse::input(input, Command, Argument);
...