0
I was looking for how string "n" functions work and I ended up finding a lot of confusion, so I was wondering if in these examples there is any chance of an overflow
// exemplo 1
#define BUFFER_SIZE 64
char buffer[BUFFER_SIZE];
snprintf(buffer, BUFFER_SIZE, "%s%s%s", "string1", "string2", "string3");
// exemplo 2
#define BUFFER_SIZE 64
char buffer[BUFFER_SIZE];
for (int i=0;i<10;i++) {
strncat(buffer, "string", BUFFER_SIZE);
}
Please edit the question to limit it to a specific problem with sufficient detail to identify an appropriate answer.
–
There is no confusion. It is easy to say whether you can or not, but what will you do after you program other things? Will you always ask someone every time the documentation doesn’t get the documentation? What do you think? Why? The question does not have a specific question, it only has a question that can answer yes or no, so it does not give a real answer, so it was closed. If I had a question that would generate an answer, I’d be okay.
– Maniero