Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Pointer again

Posted on 2002-05-29
2
Medium Priority
?
190 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
ID: 7043192
In general, I want to know how to have access to in_text
characters.
0
 
LVL 4

Accepted Solution

by:
mblat earned 400 total points
ID: 7043234
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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

824 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