-First post Woot!-
Alright, here's the problem; I'm building a _very_ simple Terminal-like program. The only problem is that in a normal Terminal (be it in Linux or Windows' "Command Prompt") there is no definitive number of inputs that you can input, for instance; you can either type "dir", or "echo BLAH BLAH BLAH", and both would work. But how would I do this in C++? When I tried to do:
cin >> arg1 >> arg2 >> arg3 >> endl;
It flipped a bitch when it didn't have _all_ of the inputs specified. And when I tried:
getline (cin, arg1);
I may have been able to put in as many arguments as I wanted, but I didn't have as much control over them as I had had before. For instance; I used to be able to type:
cin >> arg1 >> arg2 >> endl;
if(arg1 == "echo")
{
cout << arg2;
}
But I can't do that with getline().
The only other ways I could think of solving this problem, is by either writing all inputs to a text file, reading them, _then_ processing them. Or somehow splitting the inputs into tokens, and _then_ processing them. But I feel that I'm side stepping something blindingly obvious, as I am still a noob at C++. Help?
Thanks, and sorry for that wall of text XD
~Mr. Appleseed
(On a side-note, I _did_ search to see if any of this had been posted before, and though there _were_ similar posts, they were all for numbers instead of strings.... And as far as I know, you can't put a string in an 'int' ^.^ )