Re: [Libclc-developers] contribution(?): string function ultostr()
Status: Planning
Brought to you by:
augestad
|
From: Michael B.A. <mb...@io...> - 2003-03-17 21:28:39
|
On Mon, 17 Mar 2003 17:16:23 +0100 (MET) Jan Engelhardt <je...@li...> wrote: > Hi, > > copied this from my personal lib as I thought > this might be worth sharing, no? > > /*============================================================================= > ultostr > by Jan "Hirogen2" Engelhardt <hirogen2 at gmx de>, 2003 > -- distributed under the Frontier Artistic License and GNU General Public > -- License. See doc/FAL1.txt and doc/GPL2.txt for details. > ------------------------------------------------------------------------------- > NAME > ultostr - convert an unsigned long integer to a string > > SYNOPSIS > unsigned char *ultostr(unsigned long num, unsigned long base, > unsigned char *ptr, size_t size); > > DESCRIPTION > The ultostr() function converts the number NUM to a string, in > base BASE notation. BASE must be between 2 and 36 inclusive. To > summarize it, this function does (nearly) exactly the opposite > of strtoul(). I like it! No point in invoking sprintf just to convert a number like this. Mike -- A program should be written to model the concepts of the task it performs rather than the physical world or a process because this maximizes the potential for it to be applied to tasks that are conceptually similar and, more important, to tasks that have not yet been conceived. |