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.

save and retreive control characters to file

Old posts that have not been replied to for several years.
Locked
m
mferra
Voice
Posts: 4
Joined: Sun Jan 25, 2004 1:10 pm

save and retreive control characters to file

Post by mferra »

First of all hi there to all tcl gurus :)

For 3 months now I've be writing a learn script:

1. http://dicinfo.sourceforge.net/

But now I've encountered an error that I can't seem to resolve (the only bug I think). If some one does a:

!l key bbb "bla" aaa

the word bla is saved on the text file without the "". If it one does:

!l key bbb "bla" " aaa

I get a "unmatched open quote in list" error. I'm getting the text to save a definition like this:

set phrase [lrange $text 1 end]

and later:

puts $fp "$time $nick $unikey $phrase"

I've red the tcl documentation but nothing works. Especially when a odd number of " (or other control characters) appear in the definition. My idea was to save the string as is learned on the text file, and later retrieve it in the same state.

Does any one has a clue how to do this? (there can be also """bla""" inside the definition?)
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

m
mferra
Voice
Posts: 4
Joined: Sun Jan 25, 2004 1:10 pm

Post by mferra »

In the fact the problem is worst. Because the file gets the control characters has well. But the thread that you've indicated did help and the parsing is better. For future reference here is a way to convert the file again to human eyes :o :

cat dic.dat | tr -d "\173" | tr -d "\175" > dic-parsed.dat

it removes all { and } from the file.
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

The thread would have helped if you had actually read what you were looking at. You are using list operations on strings for starters, and then using list results as strings.... You need to use proper conversions when appropriate instead of going blindly into the night.
m
mferra
Voice
Posts: 4
Joined: Sun Jan 25, 2004 1:10 pm

Post by mferra »

"..going blindly into the night" was a beautiful expression to what I did. Nevertheless the problem is resolved. And thank you for the quick reply.
Locked