I'm trying to find a simplest solution to append a newline character to a string.
Although the following code works, I would like to know if it's possible to make the code simpler. (The argument should be const char*
and not std::string
)
My Code :
static void sysGui(const char *s)
{
char buf[1000];
std::strcpy(buf, s);
std::size_t size = std::strlen(s);
buf[size] = '\n';
buf[size + 1] = '\0';
sys_gui(buf);
}
char*
as an argument. \$\endgroup\$