M
mark lawler
Ok, for my assignment all my classes are working now *hooray* and all I need
to do is set up
the reading from the command line so the user can input commands. Im using
getline and a stringstream to achieve this, however I am not really
achieving much at the moment. Basically it works once, but not the next
time, as as you can see on the code below, the stream isn't filling up
again.
CODE:
string line;
string command;
string argument;
string empty;
stringstream str_stream(line);
While()
{
getline(cin, line);
if(line == "")
{
continue;
}
str_stream << line; //here is my problem, all I want to do is put the
//newly read line into the stream but it doesn¹t
//seem to be doing it. How do I do this?
str_stream >> command;
str_stream >> argument;
str_stream.flush();
...blah blah
}
to do is set up
the reading from the command line so the user can input commands. Im using
getline and a stringstream to achieve this, however I am not really
achieving much at the moment. Basically it works once, but not the next
time, as as you can see on the code below, the stream isn't filling up
again.
CODE:
string line;
string command;
string argument;
string empty;
stringstream str_stream(line);
While()
{
getline(cin, line);
if(line == "")
{
continue;
}
str_stream << line; //here is my problem, all I want to do is put the
//newly read line into the stream but it doesn¹t
//seem to be doing it. How do I do this?
str_stream >> command;
str_stream >> argument;
str_stream.flush();
...blah blah
}