PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
Utility
libsimpletools
source
itoa.c
Go to the documentation of this file.
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
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
Generated on Fri May 20 2022 16:48:05 for PropWare by
1.8.17