C++ で zfillDecember 03, 2013C++ で Python の zfill みたいな関数を作る.連番でフォルダ名とかを指定するときに便利です. std::string zfill(const std::string& str, const int width) { std::stringstream ss; ss << std::setw(width) << std::setfill('0') << str; return ss.str(); }