Text representation of a number...

: : Greetings.

: : I'm in need of an algorithm to take an eight-byte integer (not supported

: : as a native type in Windows 3.1), and print its ASCII representation

: : to a file. This number comes from a server that stores the number in

: : big-endian format, but I could switch it if necessary. If anyone

: : knows such an algorithm, or has a pointer to one, it'd be much

: : appreciated.

i fear you wont get around defining the operation "div 10"

and "mod 10" on your longish integer type. Once you have that,

you can repeatedly use x mod 10 as the next decimal digit and then

replace x by (x div 10) until x is zero.

this will yield the decimal representation in reverse order (least

significant digit first), but stringreversal shouldn't be a problem.

remains the problem of div'ing(mod'ing) your number-representation.

you'll have to build it using the / and % of smaller integertypes. (not

really easy, but it's possible)

have a look on how you divide big numbers by hand (on paper), and then

try to re-implement that algorithm.

--

/* Hereby i grant you my non-exclusive permission to share my opinions */