[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-chat] int to char *array[ ].
From: |
Piotr Nikiel |
Subject: |
Re: [avr-chat] int to char *array[ ]. |
Date: |
Sun, 4 Oct 2009 14:58:32 +0200 |
On Oct 4, 2009, at 1:41 PM, markus järve wrote:
Hello.
I am having problem due to my limited knowledge of C.
I have function readADC wich wil return value in integrer.
Sadly the function LcdStr (wich is from Fandi Gunawan library for
nokia 3310 lcd) accepts only char array pointers.
So, i need to make int 123 into char *array[3] = 1, 2, 3
I have been stuck on it for a day and have ran out of ideas. Maybe
someone could point me to the right direction or help me figure it
out.
Don't you need to use integer -> ascii conversion?
Like
char array[4];
snprintf (array, sizeof(array), "%d", readADC());
I set array to be 4 elements length, because snprintf will put
terminating zero in the last byte, but that shouldn't matter for
LcdStr, If it accepts char*.
Cheers,
Piotr