cloudformdesign:
Ok, I figured out what was happening1st -- the value of 0 shows up as a space when you print it! I wasn't aware of this "feature" before. So you are right, the second value was a zero... but you are wrong that I initialized it that way.
2nd -- I should have included the above code. The code was txt = "0 12". However, I was using a function which modified the buffer.Here is where it gets interesting. Once I modified the buffer of a constant character array... very few of the character arrays after it would work! This was happening even if I reset the pointer to "0 14" or something similar -- that second value would be always taken as 0.
I think there is something funny in the compiler (probably to save space) where you absolutely should not modify a constant character array -- once you do, you can never again know what ANY constant character arrays do!
Thanks for your help guys.
Without seeing your code, my guess is that Print (Print.cpp in the Arduino core) sees your text[] array as a string and is trying to print it as such, starting from the "offset" you gave it.
For example, imagine this:
const char *string = "hello there";
Serial.print (string[1]);
You think you would get "e", but you get "ello there". To get the result you want you have to typecast the string to tell Print what you want it to do:
Serial.print ((char) string[1]);
...will result in it printing "e".
Make sense?