Цитата
QString.setNum
Можно и так!
А можно воспользоваться статической функцией
QString::numberЦитата(Delphist @ 18.8.2008, 10:01)
Можно, конечно, вот так:
char sCode[25];
itoa(nCode, sCode, 10);
Но такое возможно только в компиляторе от Microsoft т.е. для Win32, а хотелось бы кроссплатформенно.
Кстати, что-то я не в одной справке не видел, что
itoa является внутренней функцией Microsoft (тем более для Win32)!
Цитата
Run-Time Library Reference
_itoa, _i64toa, _ui64toa, _itow, _i64tow, _ui64tow
Convert an integer to a string.
Parameters
value
Number to be converted.
string
String result.
radix
Base of value; must be in the range 2 – 36.
Return Value
Each of these functions returns a pointer to string. There is no error return.
Remarks
The _itoa, _i64toa, and _ui64toa function convert the digits of the given value argument to a null-terminated character string and stores the result (up to 33 characters for _itoa, 65 for _i64toa and _ui64toa) in string. If radix equals 10 and value is negative, the first character of the stored string is the minus sign ( – ). _itow, _i64tow, and _ui64tow are wide-character versions of _itoa, _i64toa, and _ui64toa respectively.
Security Note To prevent buffer overruns, ensure that the string buffer is large enough to hold the converted digits plus the trailing null-character and a sign character.
Так что впринципе и этой функцией тоже можешь пользоваться! Но Qt-шными просто немного удобнее.