PropWare
C++ objects and CMake build system for Parallax Propeller
Home
Download
Getting Started
Documentation
Reference
About
Related Links
Namespace List
Class List
File List
Examples
Build System
File List
File Members
propsideworkspace
Learn
Simple Libraries
Utility
libsimpletools
source
itoa.c
1
22
#include "simpletools.h"
// simpletools function prototypes
23
24
char
* itoa(
int
i,
char
b[],
int
base){
25
char
const
digit[] =
"0123456789ABCDEF"
;
26
char
* p = b;
27
if
(i<0){
28
*p++ =
'-'
;
29
i = -1;
30
}
31
int
shifter = i;
32
do
{
//Move to where representation ends
33
++p;
34
shifter = shifter/base;
35
}
while
(shifter);
36
*p =
'\0'
;
37
do
{
//Move back, inserting digits as u go
38
*--p = digit[i%base];
39
i = i/base;
40
}
while
(i);
41
return
b;
42
}
43
Generated on Sat Aug 27 2016 00:58:09 for PropWare by
1.8.12