🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #709

Re: Base10->Base32->Base10 Help Please

#709
From: Clayton Arends
Date: Wed, 27 Feb 2008 16:22
25 lines
2284 bytes
"jB" <jb@britesc.com> wrote in message 
news:47c53b22@newsgroups.borland.com...

> Could anyone please help me with a couple of small routines to convert a
> base10 number into a base32 string and a routine to convert base32 string
> into a base10 number.

You didn't answer Jason's speculation (in language.cpp) that this is 
homework.  If it is homework then you would learn more by doing it yourself 
(and you should use the .students newsgroup).

Either way there are *plenty* of examples already out there.  You just need 
to use a search engine.  If you want to search previous newsgroup postings 
then use http://groups.google.com and search for something like "base32 
base10 conversion".

The core of the algorithm is that you will take your number and continually 
divide it by 32 (taking the remainder as your string characters) until you 
are left with 0.  When converting the other way you will do the opposite, 
multiply your number by 32 and add the character from the string until the 
string is empty.  The characters in the string will use an alphabet of your 
choosing.  There are several "standards".  To see a good write-up on this go 
to http://en.wikipedia.org/wiki/Base32

Clayton 
Technical Details
Message-ID: <47c58e46$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.germany.com!newsfeed.straub-nv.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <47c53b22@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,d1e84eddc30a90a
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Clayton Arends" <nospam_claytonarends@hotmail.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <47c53b22@newsgroups.borland.com>
In-Reply-To: <47c53b22@newsgroups.borland.com>
Subject: Re: Base10->Base32->Base10 Help Please
Date: Wed, 27 Feb 2008 08:22:20 -0800
Lines: 26
MIME-Version: 1.0
Content-Type: text/plain;
 format=flowed;
 charset="Windows-1252";
 reply-type=response
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Windows Mail 6.0.6000.16480
X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6000.16545
NNTP-Posting-Host: 68.185.45.89
Message-ID: <47c58e46$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1204129350 68.185.45.89 (27 Feb 2008 08:22:30 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.germany.com!newsfeed.straub-nv.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail