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.

Reading files

Help for those learning Tcl or writing their own scripts.
Post Reply
r
ryal
Voice
Posts: 35
Joined: Thu May 12, 2005 6:10 pm

Reading files

Post by ryal »

Hi, me again
I have 2 questions regarding file reading:
1/ is there a way to read only the last line of a file. By that i mean an inbuild function. Cause i can read every line of it till i got the last, but it would be a nice time waste, wouldnt it
2/ is there a function that detects when a file has changed?

My goal is to announce when a file is modified (without having to use timers hopefully) and in that case read the last line.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

http://www.tcl.tk/man/tcl8.4/TclCmd/contents.htm and read about file, open and read.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

you need seek
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
r
ryal
Voice
Posts: 35
Joined: Thu May 12, 2005 6:10 pm

Post by ryal »

Thanks a lot
seek (combined with tell) is working just as i wanted it to
Post Reply