Archived

This topic is now archived and is closed to further replies.

alexdevmaster

BinaryToOctal

Recommended Posts

ok i''m trying to write a function that takes a string of binary digits and the outputs the equivalent string in Octal digits, i will also be doin the same for Hex, my problem is HOW THE HELL DO YOU DO IT!!, i''m so frustrated and i cant think of a good method, i''m trying to group string in 3s and then convert the little groups to octal equivalent, then regroup theses in a string, nothing i can think of works. i had some thing like this char *CBaseConvert::BinaryToOctal (char *operand,int size) { int pass = size/3; char string_piece[3]; char *result; for (int i=0; i

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Try itoa() and atoi() functions. They help you convert an int to string and string to an int.

Share this post


Link to post
Share on other sites
you know i was thinking about converting to int and then to string, but the question is what do i do with the int when i get it, i really hate asking for help, but i cant figure it out, i feel really stupid today

"Jus chillin waiting for my time to shine"
#define ALEX_DENNIS

Share this post


Link to post
Share on other sites