This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

ASCII conversion in TCL?

Old posts that have not been replied to for several years.
Locked
d
darkie
Voice
Posts: 20
Joined: Sun Feb 23, 2003 4:50 am

ASCII conversion in TCL?

Post by darkie »

How can I extract the ASCII code for a single character?

ie. The ascii code of 9 is 57.

Any help on this will be appreciated.
d
darkie
Voice
Posts: 20
Joined: Sun Feb 23, 2003 4:50 am

Post by darkie »

Never mind, I got it. It spits it out in hex, but it works:

Code: Select all

set s "h"
binary scan $s H*@0a* hex ascii
puts "Hex: $hex"
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Code: Select all

scan "9" %c
Have you ever read "The Manual"?
d
darkie
Voice
Posts: 20
Joined: Sun Feb 23, 2003 4:50 am

Post by darkie »

Thanks, that works even better!
Locked