Solved

Pointer again

Posted on 2002-05-29
2
182 Views
Last Modified: 2010-04-02
I have
int iInTextLen = 20;
char *in_text = new char[iInTextLen];
float iMyNumber;


I have in WM_CHAR messege:
in_text[strlen(in_text)]=(char)wParam;
So, every time when I pressing...

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.
Sorry for my English :)

Waiting for answer.
0
Comment
Question by:rv_man
2 Comments
 

Author Comment

by:rv_man
Comment Utility
In general, I want to know how to have access to in_text
characters.
0
 
LVL 4

Accepted Solution

by:
mblat earned 100 total points
Comment Utility
if you have

char* szMyText = "This is 60.0f";

you can do something like this

for(int ix = 0; ix < strlen(szMyText); ix++)
{
   cout << szMyText[ix];
}

for you purposes you should take a look at strtok function

#include <string.h>
#include <stdio.h>

char string[] = "A string\tof ,,tokens\nand some  more tokens";
char seps[]   = " ,\t\n";
char *token;

void main( void )
{
   printf( "%s\n\nTokens:\n", string );
   /* Establish string and get the first token: */
   token = strtok( string, seps );
   while( token != NULL )
   {
      /* While there are tokens in "string" */
      printf( " %s\n", token );
      /* Get next token: */
      token = strtok( NULL, seps );
   }
}

Hope it helps...
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now