Steve <[EMAIL PROTECTED]> writes:
>
> I came up with 2 solutions which both amounted to roughly the same code.
>
> std::string itoa(int in){
> std::stringstream out;
> out << in;
> return(out.str());
> }
>
> and
>
> char* itoa(int in){
> std::stringstream out;
> out << in;
> return(out.rdbuf.c_str());
> }
>
> So my question is, what is wrong with this method (I haven't tested it
> so there may be a minor syntax error, but that aside)?
What's wrong with that method is that it's using the standard library,
which was explicitly not available. C++ kind of hides the fact that
you're essentially calling itoa() when you do out << in there, once
you go through the overloaded function that implements <<, etc.
So, try doing it again in plain C without using any standard library
functions.
--Levi
/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/