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.
Old posts that have not been replied to for several years.
M
Maverick
Post
by Maverick » Fri Jul 05, 2002 4:40 pm
i made a script to store newslines in a textfile. Everything works fine, add news, list news, and so on. But deleting a line doesn´t work. I have no idea how to solve that thing
Wcc
Master
Posts: 278 Joined: Sun Oct 28, 2001 8:00 pm
Location: USA
Contact:
Post
by Wcc » Fri Jul 05, 2002 10:04 pm
Read the file, delete the line, write the file again.
Wcc
M
Maverick
Post
by Maverick » Sat Jul 06, 2002 6:12 pm
that´s my question Wcc !
I dont know how. I need an example because there is no command to delete a line in a textfile. Please give me an example.
Wcc
Master
Posts: 278 Joined: Sun Oct 28, 2001 8:00 pm
Location: USA
Contact:
Post
by Wcc » Sat Jul 06, 2002 11:09 pm
Try this:
Code: Select all
proc deleteline {file line} {
set fd [open $file r]
set data [split [read $fd] "\n"]
close $fd
set data [lreplace $data [expr $line - 1] [expr $line - 1]]
set fd [open $file w]
puts $fd [join $data "\n"]
close $fd
}
Wcc
M
Maverick
Post
by Maverick » Sun Jul 07, 2002 11:40 am
thats great
thanks for your help !
stdragon
Owner
Posts: 959 Joined: Sun Sep 23, 2001 8:00 pm
Contact:
Post
by stdragon » Sun Jul 07, 2002 12:18 pm
You might want to add -nonewline to your puts statement.
puts -nonewline ...
stdragon
Owner
Posts: 959 Joined: Sun Sep 23, 2001 8:00 pm
Contact:
Post
by stdragon » Sun Jul 07, 2002 12:18 pm
You might want to add -nonewline to your puts statement.
puts -nonewline ...
stdragon
Owner
Posts: 959 Joined: Sun Sep 23, 2001 8:00 pm
Contact:
Post
by stdragon » Sun Jul 07, 2002 12:18 pm
You might want to add -nonewline to your puts statement.
puts -nonewline ...
stdragon
Owner
Posts: 959 Joined: Sun Sep 23, 2001 8:00 pm
Contact:
Post
by stdragon » Sun Jul 07, 2002 12:20 pm
err, it was giving me an error, I swear! lol
something like "general error - could not find notify_email template"
so I hit reload.. I guess it was posting the whole time!
slennox
Owner
Posts: 593 Joined: Sat Sep 22, 2001 8:00 pm
Contact:
Post
by slennox » Sun Jul 07, 2002 10:09 pm
Well, now I can't delete them because your last message would be out of context
slennox
Owner
Posts: 593 Joined: Sat Sep 22, 2001 8:00 pm
Contact:
Post
by slennox » Sun Jul 07, 2002 10:22 pm
Hmm, I just received the same error when posting that. After looking up the error in the phpbb2 forums, I suspect anyone else who replies to this thread will run into the error, although the post will get through. Seems a lot of phpbb2 users are having this problem, but I couldn't see a fix.
Last edited by
slennox on Sun Jul 07, 2002 10:34 pm, edited 1 time in total.
slennox
Owner
Posts: 593 Joined: Sat Sep 22, 2001 8:00 pm
Contact:
Post
by slennox » Sun Jul 07, 2002 10:35 pm
Hmm, now the "last edited" message is showing up all of a sudden?