If I have a std::vector buffer that has room for 100 characters and I call a C function that will write a NULL terminated string like writestring(&buffer[0], buffer.size())
from what I've read that's ok if there is already data in buffer. But if the vector is empty the behavior is undefined. How do I get around that, can I write something to the buffer like "qwerty" and then call writestring() so that I know the behavior is always defined? What kind of storage do you guys use when calling C functions? I just read about .data but I don't know how common or portable that is.
Thanks