<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/13398" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2007-04-21T21:20:58-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/13398</id>

		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2007-04-21T21:20:58-04:00</updated>

		<published>2007-04-21T21:20:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=72185#p72185</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=72185#p72185"/>
		<title type="html"><![CDATA[write to a text file..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=72185#p72185"><![CDATA[
I doubt you got any result at all because $nick does not exist. Perhaps this is better:<div class="codebox"><p>Code: </p><pre><code>proc addtemp nick {  global temp  set addtemp_file [open $temp r+]  set linecount [llength [split [read $addtemp_file] \n]]  puts $addtemp_file "$linecount $nick"  close $addtemp_file  return 0}</code></pre></div>usage: addtemp &lt;nick&gt; (this is supposed to continue the count, so we assume that the pevious nicks are already numbered in the file).<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Sat Apr 21, 2007 9:20 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[sdays]]></name></author>
		<updated>2007-04-21T19:55:24-04:00</updated>

		<published>2007-04-21T19:55:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=72184#p72184</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=72184#p72184"/>
		<title type="html"><![CDATA[write to a text file..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=72184#p72184"><![CDATA[
still samething..<br><div class="codebox"><p>Code: </p><pre><code>1 lomax1 evil</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8306">sdays</a> — Sat Apr 21, 2007 7:55 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2007-04-21T19:43:27-04:00</updated>

		<published>2007-04-21T19:43:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=72183#p72183</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=72183#p72183"/>
		<title type="html"><![CDATA[write to a text file..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=72183#p72183"><![CDATA[
+ You're not reading your file. Try<div class="codebox"><p>Code: </p><pre><code>proc addtemp {} {  global temp  set addtemp_file [open $temp a+]  set lines [split [read $addtemp_file] \n]  set linecount [llength $lines]  puts $addtemp_file "[expr {$linecount+1}] $nick"  close $addtemp_file  return 0}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Sat Apr 21, 2007 7:43 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-04-21T18:41:10-04:00</updated>

		<published>2007-04-21T18:41:10-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=72181#p72181</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=72181#p72181"/>
		<title type="html"><![CDATA[write to a text file..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=72181#p72181"><![CDATA[
It would seem you reset linecount to 0 after you've read all the lines in the file. Also, rather than using foreach to increase the count, you might considder using llength (since you already split it to a list) instead.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sat Apr 21, 2007 6:41 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[sdays]]></name></author>
		<updated>2007-04-21T16:43:40-04:00</updated>

		<published>2007-04-21T16:43:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=72180#p72180</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=72180#p72180"/>
		<title type="html"><![CDATA[write to a text file..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=72180#p72180"><![CDATA[
i done that now other bug..<br><br>heres tcl:<div class="codebox"><p>Code: </p><pre><code>proc addtemp {} {  global linecount temp  set addtemp_file [open $temp a+]  set lines [split $addtemp_file "\n"]  foreach line $lines {   incr linecount  }  set linecount 0  puts $addtemp_file "$linecount $nick"  close $addtemp_file  return 0}</code></pre></div><br>here's text file:<div class="codebox"><p>Code: </p><pre><code>0 lomax0 evil</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8306">sdays</a> — Sat Apr 21, 2007 4:43 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-04-21T07:34:32-04:00</updated>

		<published>2007-04-21T07:34:32-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=72169#p72169</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=72169#p72169"/>
		<title type="html"><![CDATA[write to a text file..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=72169#p72169"><![CDATA[
You're opening the file in write-only mode. Check your "access" argument for your <a href="http://www.tcl.tk/man/tcl8.4/TclCmd/open.htm" class="postlink">open</a>-command. Best approach would be to first open your file as readonly, read all the data, close it, reopen it as write only (with truncation) and write the modified data.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sat Apr 21, 2007 7:34 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[sdays]]></name></author>
		<updated>2007-04-21T05:58:53-04:00</updated>

		<published>2007-04-21T05:58:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=72166#p72166</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=72166#p72166"/>
		<title type="html"><![CDATA[write to a text file..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=72166#p72166"><![CDATA[
ok heres what i get now "&lt;eggdrop&gt; Tcl error [temp_add]: channel "file12" wasn't opened for reading<br><br><div class="codebox"><p>Code: </p><pre><code>set temp "templist.txt"proc addtemp {} {  global file linecount temp nick  set addtemp_file [open $temp w]  set linecount 0  set lines [split [read $addtemp_file] \n]  foreach line $lines {    incr linecount  }  puts $addtemp_file "$linecount $nick"  close $addtemp_file  return 0}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8306">sdays</a> — Sat Apr 21, 2007 5:58 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[sdays]]></name></author>
		<updated>2007-04-20T19:49:43-04:00</updated>

		<published>2007-04-20T19:49:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=72160#p72160</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=72160#p72160"/>
		<title type="html"><![CDATA[write to a text file..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=72160#p72160"><![CDATA[
i need it to count the line before adding ,like add 1 then the line_here<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8306">sdays</a> — Fri Apr 20, 2007 7:49 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[sdays]]></name></author>
		<updated>2007-04-19T21:19:41-04:00</updated>

		<published>2007-04-19T21:19:41-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=72140#p72140</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=72140#p72140"/>
		<title type="html"><![CDATA[write to a text file..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=72140#p72140"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>proc addtemp {nick uhost} {  global tempfile file   set file [open $tempfile a]  puts $file "$nick $uhost"  close $file  return 0}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8306">sdays</a> — Thu Apr 19, 2007 9:19 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2007-04-19T21:12:28-04:00</updated>

		<published>2007-04-19T21:12:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=72138#p72138</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=72138#p72138"/>
		<title type="html"><![CDATA[write to a text file..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=72138#p72138"><![CDATA[
Show us your code.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Thu Apr 19, 2007 9:12 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[sdays]]></name></author>
		<updated>2007-04-19T21:07:45-04:00</updated>

		<published>2007-04-19T21:07:45-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=72137#p72137</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=72137#p72137"/>
		<title type="html"><![CDATA[write to a text file..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=72137#p72137"><![CDATA[
when my bot add a line to a text file i need it to add a num like below.<br><br>like:<div class="codebox"><p>Code: </p><pre><code>1 line2 line</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8306">sdays</a> — Thu Apr 19, 2007 9:07 pm</p><hr />
]]></content>
	</entry>
	</feed>
