INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# how to test binary format command?

## how to test binary format command?

(OP)
Hi,

I'm new in tcl programming and I'm trying to understand the binary command!
For a test I want to see the conversion from this value : ex. 300c020 but how could I see th result in binary?

#### CODE

set var "300c020
set binar [ binary format "H*" $var ] puts "result :$binar"

### RE: how to test binary format command?

Actually, I can't really tell if this is right but it's something like this.  I always have to play around with it.

#### CODE

% set a 300c020
300c020
% set b [binary format H $a] 0 % set b [binary format 7H$a]
% set b [binary format H7 $a] 0♀☻ % binary scan$b B28 c
1
% set c
0011000000001100000000100000
%

_________________
Bob Rashkin

### RE: how to test binary format command?

(OP)
So, it is the same by me!
But could you please tell me why the set c give this answer?
Normally, we should use puts to see any result?

#### CODE

%set c
0011000000001100000000100000
It is strange for me...!!

### RE: how to test binary format command?

It's just a quirk of Tcl (assuming you're asking about the use of "set").  That is, what "set" returns is displayed on STDOUT.  As for the actual binary, it is what it is, no?

_________________
Bob Rashkin

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!