473,385 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Octal number to int number

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

Sep 3 '06 #1
5 4745
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?

--
Happy Hacking,
Gaurav Vaish | http://www.mastergaurav.com
http://www.edujini.in | http://articles.edujini.in/webservices
-------------------
"GTi" <tu****@gmail.comwrote in message
news:11**********************@74g2000cwt.googlegro ups.com...
How can I convert a octal number to a integer and back again to a octal
number (2 function) ?

Sep 3 '06 #2
GTi
Gaurav Vaish (www.EduJini.IN) wrote:
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?

--
Happy Hacking,
Gaurav Vaish | http://www.mastergaurav.com
http://www.edujini.in | http://articles.edujini.in/webservices
-------------------
"GTi" <tu****@gmail.comwrote in message
news:11**********************@74g2000cwt.googlegro ups.com...
How can I convert a octal number to a integer and back again to a octal
number (2 function) ?
Just wondered if that was build into the .NET Framework
High School... hmmm long time ago...

Sep 3 '06 #3
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

Sep 3 '06 #4
string s = Convert.ToString(i, 8);
int j = Convert.ToInt32(s, 8);
Marc
Hey Marc... kewl!
Something new to me as well :)
--
Happy Hacking,
Gaurav Vaish | http://www.mastergaurav.com
http://www.edujini.in | http://articles.edujini.in/webservices
-------------------
Sep 4 '06 #5
GTi
Marc Gravell wrote:
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

Sep 5 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: Sean McIlroy | last post by:
I recently found out that unicode("\347", "iso-8859-1") is the lowercase c-with-cedilla, so I set out to round up the unicode numbers of the extra characters you need for French, and I found them...
1
by: Stan | last post by:
The convert method allows us to change any base number (bin, octal, hex ) to decimal, but how can I change a decimal value back to an octal number??? Thanks in advance Stan
27
by: fuch6921 | last post by:
I want to read in an Octal number argument and have it stored as an octal number. For instance the user will type: ./a.out 777 and it will store the octal number 777. But it atoi does this as an...
15
by: jaks.maths | last post by:
How to convert negative integer to hexadecimal or octal number? Ex: -568 What is the equivalent hexadecimal and octal number??
7
by: Gary Brown | last post by:
Hi, I have a whole bunch of integer constants that are best given in octal (PDP-1 opcodes). It makes a huge difference in readability and authenticity if these can be entered in octal. I...
10
by: laurent.pauloin | last post by:
Hello, I would like to print a signed octal. With a signed short it's printf %hi but what about an octal ? Tk !
1
by: HaifaCarina | last post by:
Here's the code is used but...but still something is wrong... i need help... /*CONVERTING DECIMAL TO OCTAL*/ String inputDeci,octal=""; int deci,count=0, i, h; ...
25
by: notahipee | last post by:
I have been trying to cin an number from 0 to 9 with a leading 0. For example 00 or 07. I was using a switch case. switch (int) { case 01: break; case 02: break;..... My problem arises at 08...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.