itoa

From: Edo (eddod_at_eddododod.dod)
Date: 09/29/04


Date: Tue, 28 Sep 2004 23:46:58 -0700

Hello
coding in c++ and like to see it portable, itoa in c is not supported by
some compilers so, here is my problem.

int x = 19;
string in = "I ";
string out = in + "am " + x;

I need to get
I am 19 from the example above.
string out = in + "am " + reinterpret_cast<string> (x); does not work
either.

thanks



Relevant Pages

  • Re: a little mistake
    ... Also the use of "inline" for that function is redundant. ... compilers will do it anyways and it isn't portable across all compilers ... int main ... Calling function would be part of the users code. ...
    (comp.lang.c)
  • Re: It works without stdio.h !!
    ... most C compilers will assume that a function that has no prototype is an ... extern int, and since you only specify functions that live in the C library, an unresolved ... never declare a variable of type char unless you well and truly believe you need to be ... strcpy, strcat, sprintf etc. with it. ...
    (microsoft.public.vc.mfc)
  • Re: Hundreds of cases in a switch, optimization?
    ... > In terms of generated machine code, how does hundreds of cases in a switch ... Do compilers or processors do any ... extern int f; ... compiled both with and without optimisation. ...
    (comp.lang.c)
  • Re: K&R-Style Function Declarations: Good or Bad?
    ... > short parameters getting promoted to int. ... all pre-ANSI compilers widened char and short ... declarations -- some compilers converted the widened types back to the ...
    (comp.lang.c)
  • Re: Is it time to legitimise REAL*8 etc?
    ... integer, which, I thought, had the same width as an int in C. ... the first does not declare a single precision integer. ... There have been compilers where it ...
    (comp.lang.fortran)