cancel
Showing results for 
Search instead for 
Did you mean: 

Extern unicodechar buffer

heyo
Senior

Hello,

I'm trying to share buffer between files but sometimes I get value sometimes not. And this is how I do this.

First of all I have button and inside button is text when I click the button it shows modal window and there is keypad. By keypad I write some numbers and click save.

0693W00000aJ1skQAC.pngWhen I click "0°C" shows keypad and KeypadSelection set to one:

0693W00000aJ1uCQAS.pngI save text like this, it copies to KeypadBuffer:

void Keypad::savedText()
{
	char* buffer_new;
	buffer_new = getText();
	Unicode::strncpy(KeypadBuffer[KeypadSelection], buffer_new, Unicode::strlen(buffer_new) + 1);
	viewPtr->CloseButtonAction();
}

And by extern I pass buffer between files. And here change correction value

	if(Unicode::strlen(KeypadBuffer[1]) > 0)
	{
		memset(&correctionvalueBuffer, 0, CORRECTIONVALUE_SIZE);
		Unicode::strncpy(correctionvalueBuffer, KeypadBuffer[1], CORRECTIONVALUE_SIZE - 1);
		correctionvalueBuffer[CORRECTIONVALUE_SIZE-1] = '\0';
		correctionvalue.resizeToCurrentTextWithAlignment();
		memset(&KeypadBuffer[1], 0, sizeof(KeypadBuffer[1]));
	}

What is problem when I sometimes got value sometimes not? Mb I need to use pointer to pass buffer between files?

0 REPLIES 0