Go Down

Topic: Changing one char of a char array (Read 501 times) previous topic - next topic

cowasaki

May 11, 2011, 10:38 am Last Edit: May 11, 2011, 10:58 am by cowasaki Reason: 1
I am having a problem with this little snippet of code:
Code: [Select]
 
   switch (IRvalue) {
     case rem0:
       Serial.println("0 pressed");
       value[pos] = '0';
       IRvalue = remright;
       GLCD.Puts(value);
       break;
     case rem1:
       Serial.println("1 pressed");
       Serial.print("Value : "); Serial.print(value); Serial.print("  at pos : "); Serial.println(pos, DEC);
       Serial.println(" ");
       Serial.println(" ");
       value[pos] = '1';
       Serial.print("Value : "); Serial.print(value); Serial.print("  at pos : "); Serial.println(pos, DEC);
       Serial.println(" ");
       Serial.println(" ");
       IRvalue = remright;
       GLCD.Puts(value);
       break;
     case rem2:


In the above code,  value  is a char array of length 11 and   pos   is an integer for the current location in an input routine.  The value  IRvalue  is the infra red value coming from the remote.....

Anyway,  the line   value[pos] = '1';   has the effect of making the array value[] blank !!

AWOL

If the value of "pos" is zero, that's what I would expect.

(well, not actually "blank", but "terminate")
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

cowasaki

This is very strange but it is now working and I have no idea why it didn't last night!

Go Up