D - Stupid Question: How to convert int to char[]?
- Russ Lewis (7/7) Sep 27 2002 How do you turn a number into is string representation? And no, I don't
- Walter (4/6) Sep 28 2002 At the moment sprintf or itoa is it, though I intend to write a set of
- Russ Lewis (9/15) Sep 30 2002 Good. I was trying to use toString, and it didn't seem to be working. ...
- Burton Radons (18/32) Sep 30 2002 Oh, you're using DLI; just use:
How do you turn a number into is string representation? And no, I don't want to use sprintf ;) -- The Villagers are Online! villagersonline.com .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] .[ (a version.of(English).(precise.more)) is(possible) ] ?[ you want.to(help(develop(it))) ]
Sep 27 2002
"Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message news:3D94CA10.8F8E957C deming-os.org...How do you turn a number into is string representation? And no, I don't want to use sprintf ;)At the moment sprintf or itoa is it, though I intend to write a set of toString() functions.
Sep 28 2002
Good. I was trying to use toString, and it didn't seem to be working. I've implemented by own toString_russ hacks that I'll use until toString gets implemented. Walter wrote:"Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message news:3D94CA10.8F8E957C deming-os.org...-- The Villagers are Online! villagersonline.com .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] .[ (a version.of(English).(precise.more)) is(possible) ] ?[ you want.to(help(develop(it))) ]How do you turn a number into is string representation? And no, I don't want to use sprintf ;)At the moment sprintf or itoa is it, though I intend to write a set of toString() functions.
Sep 30 2002
Russ Lewis wrote:Good. I was trying to use toString, and it didn't seem to be working. I've implemented by own toString_russ hacks that I'll use until toString gets implemented.Oh, you're using DLI; just use: char [] str = fmt ("%s", value); It works on all values (%s, that is - giving the wrong format code to a type merely falls back on the default). I thought the question was converting from strings to numbers. The result is allocated, but you could have: char [] statfmt (char [] format, generic [] args...) { static char [] buffer; char [] result; result = fmt (format, args...); if (result.length > buffer.length) buffer.length = result.length; buffer [ .. result.length] = result; delete result; return buffer [ .. result.length]; }Walter wrote:"Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message news:3D94CA10.8F8E957C deming-os.org...How do you turn a number into is string representation? And no, I don't want to use sprintf ;)At the moment sprintf or itoa is it, though I intend to write a set of toString() functions.
Sep 30 2002