Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can a tcl script return a binary value?

Status
Not open for further replies.

osimate

Programmer
Aug 7, 2009
1
EU
I have a mapping platform which produces ldif files for connected ldap servers.
This platform uses tcl scripts for these mappings.

For example i take a base64-encoded string for a "jpegPhoto" stored in ADS.
Then take it as an argument and then decode the string and save as a .jpg file under some directory by the help of the script.
My script returns the path of the file at the end.

However, i cannot handle the reverse scenario. Despite the fact that, ADS sends the photo data as a base64 encoded string, it only accepts binary data for the "jpegPhoto" attribute.(at far as i digged the The question is, am i allowed to return a binary value in a tcl script? As far as i tested, logs not clear but, i think i'm getting some encoding related errors. Any opinion will be appreciated.

thanks in advance..
 
You must bear in mind that "in Tcl everything is a string". So you can certainly return a binary string, but that's probably not what you want. I suggest that you return 8-bit characters whose hex representation is the binary value you want. So let's say the value is 10 (dec), that is 1010 (binary).
Code:
% set d 10
10
% set b [binary format h $d]
?

_________________
Bob Rashkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top