2023-08-16 08:47 AM
Hello everyone,
I would be mentioned this topic here which is the same.
I am using KeyboardWidget of TouchGFX in my project and need to print the value from keyboard.getBuffer() into a const char to draw it again in QRCode.
I have tried all the ways but no result and got some errors.
char QRBuffer[20];
void MainView::CreateClicked()
{
// Show the entered text in the text box on the display
Unicode::strncpy(textAreaQRBuffer, keyboard.getBuffer(), TEXTAREAQR_SIZE);
// Copy the entered text into the char string to drawing QRCode
Unicode::snprintf(QRBuffer, sizeof(QRBuffer), "%d", textAreaQRBuffer);
// Drawing the QRCode
CreateQR();
}
I have used strncpy but also no way! I have tried to casting the buffer value like this but also not working:
char* QRBuffer = (char*)textAreaQRBuffer;
Any suggestions?
Thanks, Mahdi
Solved! Go to Solution.
2023-08-16 10:01 AM
Hello
Perhaps this way:
Unicode::toUTF8(textAreaQRBuffer, (uint8_t *)QRBuffer, sizeof(QRBuffer));
Br J.T
2023-08-16 10:01 AM
Hello
Perhaps this way:
Unicode::toUTF8(textAreaQRBuffer, (uint8_t *)QRBuffer, sizeof(QRBuffer));
Br J.T
2023-08-17 12:14 AM
Perfect, Its worked 100%..
Actually i have tried it before but i have not casted the value of QRBuffer as unsigned int thats why i had many errors.
Thanks.. Mahdi