[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 205
  • Last Modified:

Easy... Very easy.

Hello experts...

Well... I have allready some C knowledge, but I almost would say that I learned C and C++ just working for Windows.
Well... I can process messages, create windows, draw bitmaps, but I don't know how to get a text string from a number.

For instances... In VB I would say:

A$ = STR$(A)... But I don't know how to do it in C++.

Any type of number... I mean... HWNDs, ints, HINSTANCEs, etc

Can anybody tell me for 15 points?. :-)
If possible... not using a huge library

1 Solution
  >>don't know how to get a text string from a number
 u mean 1234abc

  text = abc

Hi check this from the std example
#include <stdlib.h>
#include <stdio.h>

void main( void )
   char buffer[20];
   int  i = 3445;
   long l = -344115L;
   unsigned long ul = 1234567890UL;

   _itoa( i, buffer, 10 );
   printf( "String of integer %d (radix 10): %s\n", i, buffer );
   _itoa( i, buffer, 16 );
   printf( "String of integer %d (radix 16): 0x%s\n", i, buffer );
   _itoa( i, buffer, 2  );
   printf( "String of integer %d (radix 2): %s\n", i, buffer );

   _ltoa( l, buffer, 16 );
   printf( "String of long int %ld (radix 16): 0x%s\n", l,
                                                    buffer );

   _ultoa( ul, buffer, 16 );
   printf( "String of unsigned long %lu (radix 16): 0x%s\n", ul,
                                                    buffer );
Hope this helps
MarscAuthor Commented:
Thanks... I will test it...
(I didn't yet...)
But I guess that those function will work

I'm not using printf... (I'm using Text Out, since I'm programming for windows).

But I guess that those function will work

Have a nice milenium.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now