When parsing line commands in C++, is it necessary to have a separate `int name()` function for parsing? -


i designing chess game using uci protocol. program requires line commands input.

my question if need function separate main() function parsing these commands, , how input parsing? realize char* argv named in function parameter, found using argv = cin.get() didn't work.

i have looked @ many tutorials , none of them answer either question.

also i'm sorry if badly worded.

may suggest non mythical programming:

#include <string> #include <vector>  int main(int argc, char**argv) {     const std::vector<std::string> args(argv, argv+argc);      // merry , use `args`  } 

update hmm. guess meant console/standard input. in case, read loop might want:

std::string line; while (std::getline(std::cin, line)) {      // process command in line } 

Comments