Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
16 years ago

converting 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,

Andrew

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored 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).