Hi

I have declared a char array inside a local method

char tempID[16] ;

Then I read some characters from the serial port, storing everything in the array "txt". char txt[40];

I want to copy 16 characters (from the 5th to the 20th) from "txt to the tempID array, I have done it with a for loop:

for(int i=0; i<sizeof(tempID); i++)
{
tempID[i] = txt[i+4];

}


The PROBLEM is that when I display the tempID array I get all the right characters PLUSS a final character that I have no idea where comes from. (Itīs a non-printable character, probalby CR or LF). Thought it was a problem with the for loop and appended some extra characters on the txt-string but the problem remains.

Any suggestions would be appreciated.


doneirik