ich (mit Qt Creator 1.2.1, Qt 4.5.3) möchte eine Zahl in der folgenden Weise formatieren:
2 - >000002
12 -> 000012.
Es sollen also Nullen vorne rangehängt werden. Das sollte mit sprintf gehen:
Code: Alles auswählen
quint32 num = 2;
QString str = " ";
str.sprintf('%6.0f', num);
warning: character constant too long for its type
error: invalid conversion from `int' to `const char*'
error: initializing argument 1 of `QString& QString::sprintf(const char*, ...)'
Könnt Ihr mit bitte helfen.
Danke