change input logic for example.
second patch included,
change fgets to input function.
Change-Id: Id763ae718db2daaeaeac9cc55149f6eb58183361
Signed-off-by: jaesick.shin <jaesick.shin@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/11363
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Hun-je Yeon <hunje.yeon@samsung.com>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
}
}
+void input(char * buffer)
+{
+ char ch;
+ int i = 0;
+
+ while( (ch = getchar()) != '\n' && i < 100)
+ buffer[i++] = ch;
+
+ buffer[i] = '\0';
+}
+
int main()
{
int num;
case 3:
{
printf("NSSendNotification()");
- char title[100];
- char body[100];
- char topic[100];
+ char title[100] = {'\0',};
+ char body[100] = {'\0',};
+ char topic[100] = {'\0',};
printf("id : %d\n", ++id);
printf("title : ");
- gets(title);
+ input(title);
printf("body : ");
- gets(body);
+ input(body);
printf("topic : ");
- gets(topic);
+ input(topic);
printf("app - mTitle : %s \n", title);
printf("app - mContentText : %s \n", body);