You might have considered using
::GetComputerNameA()
which does the conversion for you:
std::string GetSystemName()
{
CHAR sBuf[MAX_COMPUTERNAME_LENGTH + 1] = {0};
DWORD dwLen = MAX_COMPUTERNAME_LENGTH;
::GetComputerNameA(sBuf, &dwLen);
return std::string(sBuf);
}
Note that you can do the same for any system function with a xxxA version.
cheers,
AR