Hello, I'm trying to implement a code which copies a part of a string which is pointed to by a char (*outr_message), and adds it to an unsigned-char (UART1_error_format).
For example: if *outr_message is "e97" so UART1_error_format will be err97.
the current code is:
void Serial_Output_Full_Reset(char *outr_message) { unsigned char UART1_error_format[5] = "err"; //prepare the message set_message_in_transbuffer(String_Message, outr_message, NULL, NULL, 0, 0); #if __RS485__ if (&outr_message[1] == 'e') // converting 'eXX' to 'errXX' { strncpy(UART1_error_format, outr_message + 2, 2); UART1_error_format[5] = '\0'; random_write(0 ,0 , nooutr, UART1_error_format, 2); } #endif }
after compiling there's an error appearing:
new_meas_proc.c(52): warning C214: 'Argument': conversion: pointer to non-pointer
I've tried several ways to fix the warning, which is connected to the strncpy function I believe, since I've entered to the function 'random_write' correct variables types:
void random_write(float Treal, float Emiss, unsigned char Outr,unsigned char Err, unsigned char Scale);
What should be done to fix the warning? is a conversion from char to unsigned char also needed? Thanks much, Amitai pointers are quite confusing...
I don't use the C51 compiler, and haven't looked at the compiler options available.
But note that the data type "char" might be signed. Or it might be unsigned.
Which means that "unsigned char" and "char" might be different data types. And the strxx() functions takes "char*"- not "unsigned char*".
So sending unsigned char pointer to strncpy() can give a pointer type warning.