Results 1 to 15 of 15

Thread: how do i convert an octal (base 8) value to a decimal value (base 10)

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 1999
    Location
    Lindenwold, NJ, USA
    Posts
    67
    how do i convert an octal (base 8) value to a decimal value (base 10)
    Frankie Weindel
    VB 6 Learning Edtion SP3

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>


    May or may not help...

    Val(string)

    The required stringargument is any validstring expression.

    Remarks

    The Val function stops reading the string at the first character it can't recognize as part of a number. Symbols and characters that are often considered parts of numeric values, such as dollar signs and commas, are not recognized. However, the function recognizes the radix prefixes &O (for octal) and &H (for hexadecimal). Blanks, tabs, and linefeed characters are stripped from the argument.

    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 1999
    Location
    Lindenwold, NJ, USA
    Posts
    67

    Question

    huh?
    Frankie Weindel
    VB 6 Learning Edtion SP3

  4. #4
    Addicted Member
    Join Date
    Jul 2000
    Location
    California
    Posts
    154
    How do you do binary

  5. #5
    Guest
    Originally posted by Bjwbell
    How do you do binary
    Base 10 to Binary:

    Code:
    Const a = 1
    Const b = 2
    Const c = 4
    Const d = 8
    Const e = 16
    Const f = 32
    Const g = 64
    Const h = 128
    Const i = 256
    
    
    Public Function BinConv(intval As Long) As String
    
    
        If Int(intval) >= Int(i) Then
            BinConv = BinConv & 1
            intval = intval - i
        Else
            BinConv = BinConv & 0
        End If
        Debug.Print Int(intval) & " " & BinConv
    
    
        If Int(intval) >= Int(h) Then
            BinConv = BinConv & 1
            intval = intval - h
        Else
            BinConv = BinConv & 0
        End If
        Debug.Print Int(intval) & " " & BinConv
    
    
        If Int(intval) >= Int(g) Then
            BinConv = BinConv & 1
            intval = intval - g
        Else
            BinConv = BinConv & 0
        End If
        Debug.Print Int(intval) & " " & BinConv
    
    
        If Int(intval) >= Int(f) Then
            BinConv = BinConv & 1
            intval = intval - f
        Else
            BinConv = BinConv & 0
        End If
        Debug.Print Int(intval) & " " & BinConv
    
    
        If Int(intval) >= Int(e) Then
            BinConv = BinConv & 1
            intval = intval - e
        Else
            BinConv = BinConv & 0
        End If
        Debug.Print Int(intval) & " " & BinConv
    
    
        If Int(intval) >= Int(d) Then
            BinConv = BinConv & 1
            intval = intval - d
        Else
            BinConv = BinConv & 0
        End If
        Debug.Print Int(intval) & " " & BinConv
    
    
        If Int(intval) >= Int(c) Then
            BinConv = BinConv & 1
            intval = intval - c
        Else
            BinConv = BinConv & 0
        End If
        Debug.Print Int(intval) & " " & BinConv
    
    
        If Int(intval) >= Int(b) Then
            BinConv = BinConv & 1
            intval = intval - b
        Else
            BinConv = BinConv & 0
        End If
        Debug.Print Int(intval) & " " & BinConv
    
    
        If Int(intval) >= Int(a) Then
            BinConv = BinConv & 1
            intval = intval - a
        Else
            BinConv = BinConv & 0
        End If
    End Function

  6. #6
    Addicted Member
    Join Date
    Jul 2000
    Location
    California
    Posts
    154
    thanks

  7. #7
    Guest
    Pikachu_902, I searched http://www.planet-source-code.com and a few results came up on Base Conversion.

  8. #8
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Here's some base convertion methods:
    http://forums.vb-world.net/showthrea...threadid=18927
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Dec 1999
    Location
    Lindenwold, NJ, USA
    Posts
    67
    I figured it out awhile ago from my first reply
    Frankie Weindel
    VB 6 Learning Edtion SP3

  10. #10
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840

    Thumbs up YEAH! Beats the Guru

    val("&O400") = 256!!!

    So be not so quick to judge HeSaidJoe, because he was right

    and Oct(256) = 400

    Gees, You all know &H but not &O ??

    Paul Dwyer
    Network Engineer
    Aussie In Tokyo

    Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)

  11. #11
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Yep, i think Hesaidjoe should be Guru, i didn't know the "&O" thing for instance, but i don't think you can convert to base 23 with a "&Q" hehe
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  12. #12
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840

    Thumbs up

    In Australia they'd award him the order of the Dead-Set-Legend !!

    Paul Dwyer
    Network Engineer
    Aussie In Tokyo

    Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)

  13. #13
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Hehe, what's that? DLS?
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  14. #14
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840

    Talking

    You've heard of it then?
    Paul Dwyer
    Network Engineer
    Aussie In Tokyo

    Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)

  15. #15
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    eh, no, that was a joke, like DSL connection
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width