Problem with itoa

I am trying to use itoa but get the following error

28:26: error: �itoa' was not declared in this scope
String::String
(
   const int  i
 ) {

  string  cdata = itoa (i);
  strcpy (STR, cdata.c_str ());

}

itoa is not standard function, this function is not defined in ANSI-C and C++. So it's not supported by some compiler such as g++. better you create your own function to convert int to string and then you call.

1 Like

This is itoa:

sprintf(destination_cstring, "%d", input_integer);