unsigned long to unsigned char

Discussion in 'Python' started by ashtonn@gmail.com, Jun 1, 2005.

  1. Guest

    Hello,

    Is it possible to convert unsigned long( 4 bytes) to unsigned char(1
    byte), so that i could define a common array for both.

    import array
    temp = array('B', '\0' * 512)

    for i in range( 2):
    temp[0] = 0xFF
    temp[1] = 0xFFFFFFFF

    Thanks,
    -Ashton
    , Jun 1, 2005
    #1
    1. Advertising

  2. wrote:
    > Hello,
    >
    > Is it possible to convert unsigned long( 4 bytes) to unsigned char(1
    > byte), so that i could define a common array for both.
    >
    > import array
    > temp = array('B', '\0' * 512)
    >
    > for i in range( 2):
    > temp[0] = 0xFF
    > temp[1] = 0xFFFFFFFF


    use module struct.

    Diez
    Diez B. Roggisch, Jun 1, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. George Marsaglia

    Assigning unsigned long to unsigned long long

    George Marsaglia, Jul 8, 2003, in forum: C Programming
    Replies:
    1
    Views:
    671
    Eric Sosman
    Jul 8, 2003
  2. Steffen Fiksdal

    void*, char*, unsigned char*, signed char*

    Steffen Fiksdal, May 8, 2005, in forum: C Programming
    Replies:
    1
    Views:
    575
    Jack Klein
    May 9, 2005
  3. Daniel Rudy

    unsigned long long int to long double

    Daniel Rudy, Sep 19, 2005, in forum: C Programming
    Replies:
    5
    Views:
    1,183
    Peter Shaggy Haywood
    Sep 20, 2005
  4. Ioannis Vranos
    Replies:
    11
    Views:
    757
    Ioannis Vranos
    Mar 28, 2008
  5. Alex Vinokur
    Replies:
    9
    Views:
    784
    James Kanze
    Oct 13, 2008
Loading...

Share This Page