我在 C++ 中有一个 char 数组,它看起来像 {'a','b','c',0,0,0,0}
现在我将它写入一个流,我希望它看起来像“abc”,其中包含四个空格,我主要使用 std::stiring,我也有提升。我如何在 C++ 中做到这一点
基本上我认为我在寻找类似的东西
char hellishCString[7] = {'a','b','c',0,0,0,0}; // comes from some wired struct actually...
std::string newString(hellishCString, sizeof(hellishCString));
newString.Replace(0,' '); // not real C++
ar << newString;