Solved

Pointer again

Posted on 2002-05-29
2
187 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 100 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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

734 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