I'm having a problem converting an int to a char and then appending that char to another char[] array using strcat(). I've spent sometime researching this and can't figure out where I am going wrong. Here's my code
char display_value[4]; // input value stored here for display
int keypad_value; // contains the keypad button pressed value or -1 if no button pressed
keypad_value = keypad.contains(ts_xPos, ts_yPos); // get the keypad value
char temp_val = keypad_value + '0';
const char ccTemp_val = temp_val;
strcat(display_value, ccTemp_val, 1);
No matter what I've tried, I keep getting an error message when compiling:
strcat(display_value, ccTemp_val, 1);
^~~~~~~~~~
error: invalid conversion from 'char' to 'const char*' [-fpermissive]
So how am I going wrong here? This is running inside a loop, so keypad_value and ccTemp will be ever changing as user inputs data.
char display_value[4]; // input value stored here for display
int keypad_value; // contains the keypad button pressed value or -1 if no button pressed
keypad_value = keypad.contains(ts_xPos, ts_yPos); // get the keypad value
char temp_val = keypad_value + '0';
const char ccTemp_val = temp_val;
strcat(display_value, ccTemp_val, 1);
I for one would like to see the whole sketch because there is a simpler way to build the input string given an input in a char variable from the keypad but without seeing the context it is difficult to provide specific advice