Octal number to int number

  • Thread starter Thread starter GTi
  • Start date Start date
G

GTi

How can I convert a octal number to a integer and back again to a octal
number (2 function) ?
 
Write your own code...
the same maths that you learn probably in your high-school or may be long
earlier :-)

Or do you have problems writing this code?
 
Gaurav said:
Write your own code...
the same maths that you learn probably in your high-school or may be long
earlier :-)

Or do you have problems writing this code?

Just wondered if that was build into the .NET Framework
High School... hmmm long time ago...
 
It is:

int i = 10345; // whatever
string s = Convert.ToString(i, 8);
int j = Convert.ToInt32(s, 8);
Debug.WriteLine(s);
Debug.WriteLine(j);

Marc
 
Marc said:
It is:

int i = 10345; // whatever
string s = Convert.ToString(i, 8);
int j = Convert.ToInt32(s, 8);
Debug.WriteLine(s);
Debug.WriteLine(j);

Marc

Ahh - simple.
Just what I wanted - build into the Framework
Tx Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top