I'm using snprintf()
to write string into a buffer.
#define MAXLEN 256
char line[MAXLEN];
char buf[MAXLEN];
snprintf(buf, sizeof(buf), "Hi%s", line);
When compiling, it shows warning
directive writing up to 256 bytes into a region of size 254
Any better way to solve this? I don't want to use malloc(...)
or similar dynamic allocating function.