reinterpret_cast<char*> (&buf[0]);
The vector guarantees that its elements occupy contiguous memory. So the “data” you seek is actually the address of the first element (beware of vector <bool>, this trick will fail with it). Also, why isn’t your buffer vector<char> so that you don’t need to reinterpret_cast?
Update for C++11
reinterpret_cast<char*>(buf.data());