I was wonding if there was an alternative to itoa() for converting an integer to a string because when I run it in visual Studio I get warnings, and when I compile my program under Linux, it won't even compile.
Thanks,
tomek
...
Ok, well i have been trying to write a recursive version of itoa, this is what i came up with.
void itoa(int n, char s[])
{
static int i = 0;
if(n / 10 != 0)
itoa(n/10, s);
else if(n < 0)
i = 1; /* s[0] is allready taken by - sign */
else
i = 0; /* reset i to 0 */
if(n < 0) {
...
I'm currently working with a SPC that supports ANSI C, but uses its own flavour of the GNU compiler, which doesn't compile any variadic functions and things like itoa. So using sprintf & co. isn't an option for converting integers to strings. Can anyone guide me to a site where a robust, sprintf- free implementation of itoa is listed or ...
Hi, I was looking for a way to convert an integer to a string in a portable manner (portable among at least Windows & Linux and x86 and x86_64) and I though itoa(X) to be standard just like atoi(1).
But I read the following in the Wikipedia entry:
The itoa function is a widespread non-standard extension to the standard C programmin...
I'm trying to convert an integer to a string right now, and I'm having a problem.
I've gotten the code written and working for the most part, but it has a small flaw when carrying to the next place. It's hard to describe, so I'll give you an example. Using base 26 with a character set consisting of the lowercase alphabet:
0 = "a"
1 = "...
hello,
i'm working on eclipse inside ubuntu envaironment on my c++ project.
i use itoa function (that works perfectly on visual studio) and the compiler shouts that itoa is undeclared.
in included <stdio.h>, <stdlib.h>, <iostream> and nothing help.
can someone please help me with this problem
thanks allot.
...
I recently read a sample job interview question:
Write a function to convert an integer
to a string. Assume you do not have
access to library functions i.e.,
itoa(), etc...
How would you go about this?
...
Why does this give me a memory error?
char* aVar= new char;
itoa(2, aVar, 10);
delete aVar;
Does itoa delete the aVar? How to know if a C++ function deletes the pointer, is there a convention about that?
If I do this then error doesn't occur:
char* aVar= new char;
delete aVar;
...