Here's a function that manually converts an integer to any base between 2 and 36, the parameter list is:
void toBase(
int value, // Integer value to convert
char *target, // Pointer to a large enough buffer
int base, // Base (from 2 to 36)
int fixedDigitCount // The minimum number of digits it must contain
);
This gives me the following output:
Binary with no fixed number of digits (1 to 15):
1 10 11 100 101 110 111 1000 1001 1010 1011 1100 1101 1110 1111Binary with 4 fixed digits (1 to 15):
0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
Octal with no fixed number of digits (1 to 15):
1 2 3 4 5 6 7 10 11 12 13 14 15 16 17Octal with 3 fixed digits (1 to 15):
001 002 003 004 005 006 007 010 011 012 013 014 015 016 017
Decimal with no fixed number of digits (1 to 15):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15Decimal with 4 fixed digits (1 to 15):
0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011 0012 0013 0014 0015
Hex with no fixed number of digits (1 to 15):
1 2 3 4 5 6 7 8 9 A B C D E FHex with 2 fixed digits (1 to 15):
01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F