Sign in to follow this  

sscanf problem

This topic is 4765 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have data stored in a char* as such" *data = " 3.3494229317 -0.0225959271 62.0168151855 ". When I make the call: sscanf(data, "%f %f %f", &D3DXVECTOR3); it only changes the x coordinate of the vector.

Share this post


Link to post
Share on other sites
You cannot do that. sscanf() works by analysing the provided parameters. Thus if you want to parse three floats you will have to provide three float pointers as well (also you need to pass variables, not a type!):
D3DXVECTOR3 v;
int result = sscanf(data, "%f %f %f", &v.x, &v.y, &v.z);
if (result != 3) {
// error parsing data
}

Share this post


Link to post
Share on other sites

This topic is 4765 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this