Octal number to int number

G

GTi

How can I convert a octal number to a integer and back again to a octal
number (2 function) ?
 
G

Gaurav Vaish \(www.EduJini.IN\)

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?
 
G

GTi

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...
 
M

Marc Gravell

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
 
G

GTi

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

Top