I want to do the following:
std::unique_ptr<char[]> buffer = new char[ /* ... */ ] { "/tmp/file-XXXXXX" };
Obviously, it doesn't work because I haven't specified the size of a new array. What is an appropriate way to achieve my goal without counting symbols in a string literal?
Usage of std::array is also welcome.
Update #1: even if I put the size of array, it won't work either.
Update #2: it's vital to have a non-const access to the array as a simple char* pointer.
string- which incidentally offers the right constructor too. Wellsizeof("/tmp/lala")will work for the size if it's a constant (that includes the\0too though so be careful).