Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > unsigned long to unsigned char

Reply
Thread Tools

unsigned long to unsigned char

 
 
ashtonn@gmail.com
Guest
Posts: n/a
 
      06-01-2005
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

 
Reply With Quote
 
 
 
 
Diez B. Roggisch
Guest
Posts: n/a
 
      06-01-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Casting from const pair<const unsigned char*, size_t>* to constpair<unsigned char*, size_t>* Alex Vinokur C++ 9 10-13-2008 05:05 PM
Padding bits and char, unsigned char, signed char Ioannis Vranos C++ 11 03-28-2008 10:47 PM
Linking error LNK2001 - "__declspec(dllimport) private: void __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Tidy(unsigned short)" (__imp_?_Tidy@?$basic_string@DU?$char_ sharmadeep1980@gmail.com C++ 1 07-07-2006 07:27 AM
void*, char*, unsigned char*, signed char* Steffen Fiksdal C Programming 1 05-09-2005 02:33 AM
Assigning unsigned long to unsigned long long George Marsaglia C Programming 1 07-08-2003 05:16 PM



Advertisments