私は次のコードを持っています:
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
ゼロなし?どうした?