Can anyone made a code that creates array of chars mychars(first char has value '3' ,2 char:'.',3:'1',4:'4')and then converts it into float mynumber.
Who is Participating?
jkrConnect With a Mentor Commented:
Use 'strtod()' or 'atof()':

/* STRTOD.C: This program uses strtod to convert a
 * string to a double-precision value; strtol to
 * convert a string to long integer values; and strtoul
 * to convert a string to unsigned long-integer values.

#include <stdlib.h>
#include <stdio.h>

void main( void )
   char   *string, *stopstring;
   double x;
   long   l;
   int    base;
   unsigned long ul;
   string = "3.1415926This stopped it";
   x = strtod( string, &stopstring );
   printf( "string = %s\n", string );
   printf("   strtod = %f\n", x );
   printf("   Stopped scan at: %s\n\n", stopstring );
   string = "-10110134932This stopped it";
   l = strtol( string, &stopstring, 10 );
   printf( "string = %s", string );
   printf("   strtol = %ld", l );
   printf("   Stopped scan at: %s", stopstring );
   string = "10110134932";
   printf( "string = %s\n", string );
   /* Convert string using base 2, 4, and 8: */
   for( base = 2; base <= 8; base *= 2 )
      /* Convert the string: */
      ul = strtoul( string, &stopstring, base );
      printf( "   strtol = %ld (base %d)\n", ul, base );
      printf( "   Stopped scan at: %s\n", stopstring );

/* ATOF.C: This program shows how numbers stored
 * as strings can be converted to numeric values
 * using the atof, atoi, and atol functions.

#include <stdlib.h>
#include <stdio.h>

void main( void )
   char *s; double x; int i; long l;

   s = "  -2309.12E-15";    /* Test of atof */
   x = atof( s );
   printf( "atof test: ASCII string: %s\tfloat:  %e\n", s, x );

   s = "7.8912654773d210";  /* Test of atof */
   x = atof( s );
   printf( "atof test: ASCII string: %s\tfloat:  %e\n", s, x );

   s = "  -9885 pigs";      /* Test of atoi */
   i = atoi( s );
   printf( "atoi test: ASCII string: %s\t\tinteger: %d\n", s, i );

   s = "98854 dollars";     /* Test of atol */
   l = atol( s );
   printf( "atol test: ASCII string: %s\t\tlong: %ld\n", s, l );

Axter, having seen the other Qs posted by rv_man, I don't think it's homework...
Is this homework?

It's agaisnt EE policy to do homework for questioners.
Please provide some of your code, and we can assist you with specific questions.
rv_manAuthor Commented:
First of all thats not my homework. I just "playing" with
direct3d and to "play" with it I must know how pointer and stl works. I "prof." in java but I just began learning c++. I know what pointer is but I don't know how to work with it :)
Now my question:
I have
int iInTextLen = 20;
char *in_text = new char[iInTextLen];
float iMyNumber;

I have in WM_CHAR messege:
So, every time when I pressing... ok.

I running my programm and typing for example "new vector 60.0f 60.0f 0.5f 1.0f 0xffff0000"
So, it goes to in_text.
Now I want ,for example, place 60.0f from in_text in iMyNumber.

Thats it. I asking it because I don't even know how to do it: with pointer or with help of stl.

Sorry for my English :)

Waiting for answer.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.