Converting int to a string to print on screen

Started by
14 comments, last by Mad One 20 years ago
quote:And how would you do that in C#?


It''s real hard:

int x;
string y = x.ToString();
"When you die, if you get a choice between going to regular heaven or pie heaven, choose pie heaven. It might be a trick, but if it's not, mmmmmmm, boy."
How to Ask Questions the Smart Way.
Advertisement
oh...for sure...

I meant: string (char) to int
QB 4 EVER
oh...for sure...

I meant: string (char) to int
QB 4 EVER
always use snprintf over sprintf. All those string functions without the ''n'' are a segfault waiting to happen.
quote:oh...for sure...

I meant: string (char) to int


That''s even harder!

int x = Int32.Parse("10");

"When you die, if you get a choice between going to regular heaven or pie heaven, choose pie heaven. It might be a trick, but if it's not, mmmmmmm, boy."
How to Ask Questions the Smart Way.
quote:Original post by kdogg
always use snprintf over sprintf. All those string functions without the ''n'' are a segfault waiting to happen.

Unless you''re printing a single integer to a buffer that''s larger than any possible string representation of any integer in any conceivable standard implementation, in which case it''s simply efficient.

[twitter]warrenm[/twitter]

This topic is closed to new replies.

Advertisement