After so much problems in handling the interrupts, I've decided to use the KBHIT approach (https://www.edaboard.com/threads/277650/). Now, everything is ok but I have a doubt about dynamic memory use.
In my code, I have a pair of routines to write and read data from EEPROM. Both are based on native CCS EEPROM routines.
I don't know why, but this routine only works well when I declare the variable 'TEXTO' as a static length array. When I use the dynamic array associated with calloc, the array TEXTO always returns with wrong length (per example, if the right length would be 10, it returns 12).
At the first moment, I determined the size of array using the calloc instruction:
Code:
char* texto = calloc((high-low),sizeof(char));
But it never worked well...the array 'TEXTO' always returns the wrong size.
Looking your reply about my code doesn't ensure the null-terminated character and some related doubts in other places around the internet, I've tried to increase by 1 Byte the size of array in the calloc instruction (i.e
About that... which is that return value?
For example, if strlen(texto) would be used, length would be determined looking at the first null character.
Looking your reply about my code doesn't ensure the null-terminated character and some related doubts in other places around the internet, I've tried to increase by 1 Byte the size of array in the calloc instruction (i.e