Also,
⧺SL.io.50 Don't use endl.
Don't explicitly compare against nullptr. Use the truth value of the pointer (or smart pointer!): if (argv[++i]). In this case, modifying the index as part of the long expression that refers to it several times is confusing. I get the idea that this is boilerplate code anyway, so use a proper library instead of pasting it.
size_t bufSize = sizeof(bufToWrite)/sizeof(DType);
DType toRestore[bufSize] = {};
First of all, that second line is not actually legal in C++. gcc accepts C-style VLA's as an extension with no warning, but incorporating this into the C++ standard was rejected for good reason.
Don't use sizeof on an array. It is fragile and can easily accidently give you the size of a pointer instead. Here you just want the number of elements in the array: that's std::size(bufToWrite).
But really, you just want to duplicate the type of bufToWrite in both its array size and element type. So just write "I want another variable the same as that one" directly:
decltype(bufToWrite) toRestore;