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.
Help for those learning Tcl or writing their own scripts.
zhjwp
Voice
Posts: 2 Joined: Wed Mar 12, 2008 3:55 am
Post
by zhjwp » Wed Mar 12, 2008 3:58 am
#!/usr/bin/expect -f
set file_no [open ./test w]
puts -nonewline $file_no \xc0
But the output is two bytes: 0xc3 0x80.
(If it is \x7c, it is can be output correctly. It seems that as long as the highest bit is 1, the output is incorrect)
What is wrong?
Thanks!!!
zhang
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Wed Mar 12, 2008 1:35 pm
zhjwp wrote: What is wrong?
utf-8
You probably want
Code: Select all
fconfigure $file_no -translation binary
Have you ever read "The Manual"?
zhjwp
Voice
Posts: 2 Joined: Wed Mar 12, 2008 3:55 am
Post
by zhjwp » Wed Mar 12, 2008 9:41 pm
Thanks a lot! It is a great help!!