Jump to content

VEX : How to convert a float into a string


sanostol

Recommended Posts

  • 4 years later...

Question: We have atoi() and itoa() where you can convert a string to integer/vice versa. And then we have atof() which converts a string to float - but no equivalent for the other way around. Am I missing something or does it simply not exist?

Link to comment
Share on other sites

well, sprintf() can do more to floats than just "convert", (maybe that is the reason plain ftoa() doesn't exist?)

you can specify the padding and number of decimal points it will round to, like: sprintf("%08.3f", value);

unfortunately, when I just tried it seems to be broken for some reason

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...