Modify SSM Linux Sample App to to prevent unexpected input values
Change-Id: Ic9de6e894a44a903f02d60f6eeaf0fa9035e0e5a
Signed-off-by: Minji Park <minjii.park@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/315
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
(cherry picked from commit
d37ac7328d1f6bf0fc8da65aac9af8b0edcdd904)
Reviewed-on: https://gerrit.iotivity.org/gerrit/384
Reviewed-by: Sudarshan Prasad <sudarshan.prasad@intel.com>
printf("searching SSMResource\n");
SSMTestApp *SSMApp = new SSMTestApp();
APPMenu::APPMenu menu = APPMenu::NONE;
+ std::string strMenu;
std::string xmlDescription = "<SSMCore>"
"<Device>"
{
SSMApp->displayMenu();
- menu = (APPMenu::APPMenu) (getchar() - '0');
- if ((APPMenu::APPMenu) 0 > menu || menu > APPMenu::EXIT)
- menu = (APPMenu::APPMenu) (getchar() - '0');
+ getline(cin, strMenu);
+ menu = (APPMenu::APPMenu) (atoi(strMenu.c_str()));
switch (menu)
{