我有下一个代码:
ofstream dataIndex;
dataIndex.open("file");
index="2222";
std::stringstream sstr1;
sstr1<<index<<'1';
sstr1<<setfill('0')<<setw(index.length()-9);
string index1= sstr1.str();
dataIndex<<index1;
dataIndex.close()
我希望结果:
2222100000
但只有我得到
22221
没有零?发生了什么?