I have gotten in the habit of using strings to manage character buffers
that I pass in to unix system calls.
For example, suppose I want to create a character buffer to use with
the "write" system call.
string buf(1024);
int fd;
write(fd,(void *)(&buf[0]),buf.size());
It recently occured to me that the standard C++ library doesn't
necessarily guarantee that a vector<char> or string will be implemented
in terms of a single c array of char, so that by taking creating a
pointer to the first element of the string or vector and passing it
into a function expecting a c array of char I could be making my
programs non-portable.
Does anyone know if the standard makes any guarantees one way or the
other?
Does anyone find my practice a bad idea?
Chris