Форум программистов «Весельчак У»
  *
Добро пожаловать, Гость. Пожалуйста, войдите или зарегистрируйтесь.
Вам не пришло письмо с кодом активации?

  • Рекомендуем проверить настройки временной зоны в вашем профиле (страница "Внешний вид форума", пункт "Часовой пояс:").
  • У нас больше нет рассылок. Если вам приходят письма от наших бывших рассылок mail.ru и subscribe.ru, то знайте, что это не мы рассылаем.
   Начало  
Наши сайты
Помощь Поиск Календарь Почта Войти Регистрация  
 
Страниц: [1]   Вниз
  Печать  
Автор Тема: проблема с преобразованием  (Прочитано 6333 раз)
0 Пользователей и 1 Гость смотрят эту тему.
4upka
Гость
« : 17-09-2007 15:18 » 

как преобразовать число в строку
пример
из
int i=1324543
в
char k[].
Записан
Tuborg
Команда клуба

ee
Offline Offline

« Ответ #1 : 17-09-2007 15:35 » 

методы itoa, _itoa, _ultoa
Записан
4upka
Гость
« Ответ #2 : 17-09-2007 15:42 » 

а гиде про них написано!можешь подсказать?заранее спасибо!
Записан
Алексей++
глобальный и пушистый
Глобальный модератор

ru
Offline Offline
Сообщений: 13


« Ответ #3 : 17-09-2007 18:36 » new

Код:
<stdlib.h>

char *_itoa( int value, char *string, int radix );

value - Number to be converted
string - String result
radix - Base of value; must be in the range 2 – 36

Return Values - Each of these functions returns a pointer to string.
There is no error return.

Remarks
The _ltoa function converts the digits of value to a null-terminated
character string and stores the result (up to 33 bytes) in string. The
radix argument specifies the base of value, which must be in the range
2 – 36. If radix equals 10 and value is negative, the first character
of the stored string is the minus sign (–). _ltow is a wide-character
version of _ltoa; the second argument and return value of _ltow are
wide-character strings. Each of these functions is Microsoft-specific.

Код:
char *_ultoa(
   unsigned long value,
   char *string,
   int radix
);

value - Number to be converted.
string - String result.
radix - Base of value.

Return Value - Each of these functions returns a pointer to string.
There is no error return.

Remarks
The _ultoa function converts value to a null-terminated character string
and stores the result (up to 33 bytes) in string. No overflow checking is
performed. radix specifies the base of value; radix must be in the range
2 – 36. _ultow is a wide-character version of _ultoa.
Записан

Страниц: [1]   Вверх
  Печать  
 

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines