If an user hits a "enter" key, the application will give a menu
to the user, again.
Reference: [IOT-335]
Change-Id: Ie32b6f705b76e7ab455f3208d08f8c8be14dc685
Signed-off-by: Jihun Ha <jihun.ha@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/571
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
int main(int argc, char* argv[])
{
+ std::string str_steps;
//**************************************************************
// STEP 0
cout << "(6) Reboot (for the group)" << std::endl;
cout << "(10) Show Configuration Units" << std::endl;
- cin >> g_Steps;
- //
+ try
+ {
+ std::getline (std::cin, str_steps);
+
+ if(str_steps == "")
+ continue;
+ else
+ g_Steps = std::stoi(str_steps);
+ }
+ catch(std::invalid_argument&)
+ {
+ std::cout << "Please put a digit, not string" << std::endl;
+ continue;
+ }
+
if (g_Steps == 0)
break;
else if (g_Steps == 1)