Well, this is not a popup, but one way to do this would be to dynamically build a format string:
#include <boost/format.hpp>
#include <boost/lexical_cast.hpp>
int main()
{
int n = 5;
const std::string f("%" +
boost::lexical_cast<std::string>(n * 2) + "." +
boost::lexical_cast<std::string>(n * 2) + "s");
std::string s = (boost::format(f) % "Hello").str();
}
, , .
boost::format() ; , , :
const std::string f = (boost::format("%%%d.%ds") % (n*2) % (n*2)).str();
std::string s = (boost::format(f) % "Hello").str();
( Ferruccio )