Click to See Complete Forum and Search --> : itoa and stdlib.h


saai
11-21-2000, 10:03 PM
I am using c++, and want to convert an integer to a string using itoa(). I looked in my C book and MSDN, which both say that itoa() is in stdlib.h
So, I include stdlib.h in my source code, use itoa further down in my code, and try to compile. When I compile, I get an error stating that the function itoa() cannot be found.
I've looked for manpages on itoa(), but cannot find any. Does anyone know why I can't use itoa() in linux?

Saai

jemfinch
11-22-2000, 01:00 AM
itoa() doesn't exist. Use snprintf() instead.


char buf[BUFSIZE];
return_val = snprintf(buf, sizeof(buf), "%d", your_number);


Jeremy