469,898 Members | 1,729 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

mac address

Hello,
I am a newbie and i have problems filling an array with the mac address
read from the command line.

The mac address is FF:FF:FF:FF:FF:FF

options, args = parser.parse_args()
# options.d contains the address
destAddress = options.d

data = array('L', '\0' * 24)
The array should contain the data as follows:
data[0] = 0xFF
data[1] = 0xFF
.........
data[5] = 0xFF
Any help is appreciated
-SB

Jul 19 '05 #1
1 1839
sh********@gmail.com wrote:
Hello,
I am a newbie and i have problems filling an array with the mac address
read from the command line.

The mac address is FF:FF:FF:FF:FF:FF

options, args = parser.parse_args()
# options.d contains the address
destAddress = options.d

data = array('L', '\0' * 24)
The array should contain the data as follows:
data[0] = 0xFF
data[1] = 0xFF
........
data[5] = 0xFF
Any help is appreciated
-SB


You will be better off in the long run if you try to solve these minor
questions yourself.

Break the problem down:

First step: *split* the destAddress into 6 strings
Second step: convert the strings to *long* integer, remembering to use
base 16 arithmetic
Third step: use the resulting 6-element list when creating "data".

Why do you think you need array.array('L', ....)? What are you going to
do with "data" after filling it with the address?

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

21 posts views Thread by Alexander N. Spitzer | last post: by
8 posts views Thread by YAN | last post: by
4 posts views Thread by andreas.w.h.k. :-\) | last post: by
6 posts views Thread by Nicolas Noakes | last post: by
36 posts views Thread by Julienne Walker | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.