You may have two problems:
If you want to write it yourself, you might like the div function. You feed in the number and the base, and it splits off the rightmost digit. Repeat to get all digits.
If you want to be more efficient, you can divide by the base squared, and get two digits at a time (use a lookup table to get the ASCII characters for both digits). Here's an example of some very efficient implementations. Changing it to use a different base would not be difficult.