trying to make it work

Stopped compiling.
std::string and std::wstring are automatically initialised to an empty string, in a way that's more efficient than doing the conversion from char or wchar_t, so it's better to just do:
wstring name, rnattrib;