Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/26/03 12:11
Read: times


 
#37296 - "C" : putting characters into strings
Hi,

I need to set timer values (e.g. "005", "120") into a 16-byte string which is sent to an LCD.
There are 4 positions (1, 5, 9, 13) for the hundreds byte.
What is an easy way to set timer3 (pos 9) to "120", for example?

(bits of myprog.c)
...
const char time005[] = "005";
const char time120[] = "120";
...
const unsigned char timer[4] = { 1, 5, 9, 13 }; //"h" position in timer display line
...
char timers[16]; //lcd line 2
...

/*
there must be an easier way than this!!
(device is 0 thru 3)
*/
for (i=0; i<3; i++) timers[timer[device]+i] = time005[i];


TIA,

Richard.be

PS I *still* wince when some-one writes "LCD display" - when will they learn!


List of 14 messages in thread
TopicAuthorDate
"C" : putting characters into strings            01/01/70 00:00      
RE: "C" : putting characters into string            01/01/70 00:00      
RE: "C" : putting characters into string            01/01/70 00:00      
RE: "C" : putting characters into string            01/01/70 00:00      
printf - putting characters into strings            01/01/70 00:00      
RE: \\            01/01/70 00:00      
RE: "C" : putting characters into string            01/01/70 00:00      
RE: "C" : putting characters into string            01/01/70 00:00      
RE: "C" : putting characters into string            01/01/70 00:00      
RE: "C" : putting characters into string            01/01/70 00:00      
RE: tautology            01/01/70 00:00      
RE: tautology.....more            01/01/70 00:00      
RE: tautology.....more            01/01/70 00:00      
RE: "C" : putting characters into string            01/01/70 00:00      

Back to Subject List