Originally Posted by
maven
HI,
see i tried in both the ways. but i have seen any printf() or sprintf(). is not working there. it just giving a crash with saying process killed at some signal.
i think if i ll put value directly in a array or pointer. like
a[0]= hour;
a[1]=min;
a[2]=sec;
then it could work.. but the problem is i have to store a delimeter also like
a[0]=#hour;
Now tell me how can i do it.
I'm making some HUGE assumptions here, because you haven't really posted enough code to "fill in the blanks."
If what you are trying to accomplish is something like this:
Code:
char ptr[20];
sprintf(ptr,"#%d#%d#%d",hour, min, second);
Then what you will end up with (assuming of course that your ptr buffer is large enough) would be something like this:
ptr[0] = '#'
ptr[1] = 12 /*assuming hour is 12 */
ptr[2] = '#'
ptr[3] = 38 /* assuming minute is 38 */
So, in other words, you won't have something like:
ptr[0] = "#hour"
If you want something like that, you'd probably need an "array of strings" (generically speaking).