I try developing a calculator. i desinged a gui and now i developing event functions, i want do if a button come event, take the button name(number) and add my label. But now i have a problem. The problem is this; I can take text from label and i add my new value with printf() function but sprintf() function dont take after from 2 value. Why ? How can finf solition?
there below the output on simulator and console;
there below my code in event function ;
static const char * number_BtnMapValues[10] = { "9", "8", "7", "6", "5", "4", "3", "2", "1", "0"}; const uint8_t * number_BtnValuesInt[10] = { 9,8,7,6,5,4,3,2,1,0}; for (int sayac = 0; sayac < 10; sayac++) { if (0 == strcmp(number_BtnMapValues[sayac], lv_btnm_get_active_btn_text(obj))) { if (lv_obj_get_screen(tos_calculatorDisplayLabel) == lv_scr_act()) { if (0 == strcmp("0", lv_label_get_text(tos_calculatorDisplayLabel))) { snprintf(calculatorBuf, 32, "%s",lv_btnm_get_active_btn_text(obj)); printf("%s\n", lv_btnm_get_active_btn_text(obj)); } else { snprintf(calculatorBuf, 32, "%s%s", lv_label_get_text(tos_calculatorDisplayLabel), lv_btnm_get_active_btn_text(obj)); printf("%s%s\n", lv_label_get_text(tos_calculatorDisplayLabel), lv_btnm_get_active_btn_text(obj)); } lv_label_set_text(tos_calculatorDisplayLabel, calculatorBuf); } } } if (0 == strcmp(".", lv_btnm_get_active_btn_text(obj))) { printf(". was pressed\n"); } else if (0 == strcmp("=", lv_btnm_get_active_btn_text(obj))) { printf("= was pressed\n"); }