Forum Discussion
Altera_Forum
Honored Contributor
16 years agoconverting integers to strings and vice versa
I have an integer, 255, that I would like to convert to the string "255" for file IO. Any idea how I can do this?
Thanks, Andrew3 Replies
- Altera_Forum
Honored Contributor
Either use sprintf() or itoa().
Jake - Altera_Forum
Honored Contributor
Or write your own. I have one. I'll see if I can find it.
Jake - Altera_Forum
Honored Contributor
sprintf() is the more standard way to do this. If you want something light weight use a loop and %10 and /10 operations to pluck out the characters (I'm pretty sure that's how itoa() works).