Announcement

Collapse
No announcement yet.

VAL problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • VAL problem

    Hi there!!

    I have problem running this in PB maybe there are too many bits
    if it's so I need a manner to achieve it...

    A$ = "&h101100111000101010011001100110" '30 BITS
    C??? = VAL(a$)

    PB freeze on "C??? = VAL(a$)" if i reduce the number of byte
    it's ok but... How can I put a string of 30bits in a DWORD?

    if you know please tell me )

    The Hope Man


  • #2
    Use the &B prefix for binary within the VAL expression.

    a$ = VAL("&B1010101010101010")

    Note that if the high-order bit is non-zero, PB will assume the value is signed. Prefix with a zero to force it to be unsigned.

    a$ = VAL("&B01010101010101010")

    I hope this helps!

    PS: &H is for Hex, so 30 hex digits is actually 120 binary bits!




    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment

    Working...
    X