Hello, colleagues!
My question is about work with function sprintf in Keil C for ARM.
I have a structure for RTC, that looking as:
struct { unsigned char SEC; unsigned char MIN; unsigned char HOUR; unsigned char DWEEK; unsigned char DAY; unsigned char MONTH; int YEAR; } RTC8583;
I try to write function that showing time:
sprintf (BUFF,"%02d:%02d:%02d", (unsigned)RTC8583.HOUR,(unsigned)RTC8583.MIN,(unsigned)RTC8583.SEC);
And after compilation, a message is displayed all the time:
... compiling M1132_MAIN.c... MAIN\M1132_MAIN.c(284): warning: #167-D: argument of type "BYTE *" is incompatible with parameter of type "char *restrict" sprintf (BUFF,"%02d:%02d:%02d", (unsigned)RTC8583.HOUR,(unsigned)RTC8583.MIN,(unsigned)RTC8583.SEC); MAIN\M1132_MAIN.c: 1 warning, 0 errors ...
I can’t understand how to do it right so that there is no warning!
It is still strange that neither in Borland C++, nor in Keil C for C51 such a is observed!
Help me please!
Hello, Ronan!
Until yesterday, I always used the BUFF1 option inside and outside the function, as well as the BUFF3 option inside the function...
And I received a warning, although the code executed correctly for the BUFF1.
Yesterday I defined BUFF3 outside the function - the warning disappeared... Although this is generally strange, because the definition of the BUFF1 is correct in most cases ...
Regards,
Oleg Nicolaiciuc