Hi all,
I can’t find how to fix this warning. Pointers are not my most favorites
so I call fanction:
prnt_1arg("this text shall go to serial terminal and argument is equal = %d", integer_variable);
and function look like this:
UnbufferedSerial pc(USBTX, USBRX, 115200);
const char *new_line= "\n\r";
char buf_out[32];
void prnt_1arg(char *buff , int value){
int newSize = strlen(buff) + strlen(new_line) + 1;
char * newBuffer = (char *)malloc(newSize);
strcpy(newBuffer,buff);
strcat(newBuffer,new_line);
sprintf(buf_out, newBuffer, value);
pc.write(&buf_out, strlen(buf_out)); //
memset(buf_out, '\0', sizeof(buf_out));
}
}
I still get a warning: ISO C++ forbids converting a string constant to ‘char*’
WhatI need to change to remove warnings ?
Thanks
Michal