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.

read a joke from a file

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

read a joke from a file

Post by ComputerTech »

What would be the best way to read a joke from a txt file like this

Code: Select all

"joke 1 here and so on
joke1 still here and heeeeeereee
joke 1 ends here"
"joke2 starts here, and continues...
still here too!
and ends here..."
possible to use " " to specify the start and end of a line? or what would be the best way, thanks in advanced :P
ComputerTech
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

Post by ComputerTech »

Nevermind, Thanks to DasBrain, i found what i needed.

Here's my code:

Code: Select all

inside jokes.txt

"joke 1 here
still here
ending here"
joke2 here
still here
ending here"

set fd "scripts/jokes.txt"
set jokes [read $fd]
ComputerTech
Post Reply