RE: [AD] Reverse String function... |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
char szDest[255];
char *pszDest=szDest;
[...]
return (pszDest);
}
You're returning a pointer to the stack which will get unwinded
before you have a chance to get the ptr.
In other words, it doesn't work.
Either return allocated memory, or declare dzDest as static
(in which case beware mutliple calls before you use the result).
More to your question, such code is not all purpose. Allegro's
string functions are geared towards using Unicode, or handy
routines (like case insensitive compares). I don't think such
an strrev routine would be much used by Allegro coders around.
What kind of uses did you find for it ?
--
Vincent Penquerc'h
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |