469,267 Members | 1,643 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,267 developers. It's quick & easy.

unsigned long to unsigned char

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

Jul 19 '05 #1
1 2030
as*****@gmail.com 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
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Siemel Naran | last post: by
2 posts views Thread by Goran | last post: by
3 posts views Thread by Nicholas Zhou | last post: by
14 posts views Thread by moumita | last post: by
6 posts views Thread by Kislay | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.