This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

sprintf && struct

Hi All,

I have following struct:

struct timedate{
unsigned char sec; // 00 to 59
unsigned char min; // 00 to 59
unsigned char hrs; // 00 to 23
unsigned char date; // 01 to 31
unsigned char month;// 01 to 12
unsigned char year; // 00 to 99
}mystruct={00,00,12,01,01,02};

char mystring[12];

how can i use sprintf() or any other function to put 'timedate' into mystring ??

----------------------------------------

Why is the following assignment illegai ??
unsigned char mych=1;
sbit pin1 = P3^1;

pin1 = mych;

What i am trying to do is to assign the MSB or LSB of mych to pin1. How can that be done ??

Thankzz && Bye
-Rocknmoon

Parents
  • "how can i use sprintf() or any other function to put 'timedate' into mystring ??"

    You will need to access each field in turn.

    Please, just ask one question at a time - otherwise the 'Summary' in the Thread list becomes meaningless, and it gets very difficult to see which answer in a thread relates to which question!
    Please repost your 2nd question as a separate thread.

Reply
  • "how can i use sprintf() or any other function to put 'timedate' into mystring ??"

    You will need to access each field in turn.

    Please, just ask one question at a time - otherwise the 'Summary' in the Thread list becomes meaningless, and it gets very difficult to see which answer in a thread relates to which question!
    Please repost your 2nd question as a separate thread.

Children
No data