<?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/15402" />

	<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>2008-02-20T04:26:27-04:00</updated>

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

		<entry>
		<author><name><![CDATA[dokueki]]></name></author>
		<updated>2008-02-20T04:26:27-04:00</updated>

		<published>2008-02-20T04:26:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=80988#p80988</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=80988#p80988"/>
		<title type="html"><![CDATA[Explanation on File Reading?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=80988#p80988"><![CDATA[
Alright, thanks again! Works like a charm :3<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8949">dokueki</a> — Wed Feb 20, 2008 4:26 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2008-02-19T16:29:43-04:00</updated>

		<published>2008-02-19T16:29:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=80973#p80973</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=80973#p80973"/>
		<title type="html"><![CDATA[Explanation on File Reading?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=80973#p80973"><![CDATA[
To open a random (already existing) file, I'd suggest you first get a list of files using <em class="text-italics">glob</em>, get the lenght of the list using <em class="text-italics">llength</em>, and generate a random number between 0 and length-1 (using <em class="text-italics">rand</em>) to be used with lindex to retrieve the randomly selected file.<br><div class="codebox"><p>Code: </p><pre><code>set files [glob "mydir/*"]set file [lindex $files [rand [llength $files]]]</code></pre></div>Once you have the filename, perform your file operations just as you would with any other file.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Feb 19, 2008 4:29 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[dokueki]]></name></author>
		<updated>2008-02-19T08:40:00-04:00</updated>

		<published>2008-02-19T08:40:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=80970#p80970</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=80970#p80970"/>
		<title type="html"><![CDATA[Explanation on File Reading?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=80970#p80970"><![CDATA[
Alright, I'm sorry I didn't check there :C I'll try what the topic there says and I'm pretty sure it'll work. One thing though, how can I pick a random file from a list of files in a directory? Is that possible? Thanks again in advance :3<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8949">dokueki</a> — Tue Feb 19, 2008 8:40 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2008-02-19T07:25:14-04:00</updated>

		<published>2008-02-19T07:25:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=80968#p80968</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=80968#p80968"/>
		<title type="html"><![CDATA[Explanation on File Reading?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=80968#p80968"><![CDATA[
If you have questions after reading the FAQ forum, specifically the faq dealing with reading/writing files, let us know.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Tue Feb 19, 2008 7:25 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[dokueki]]></name></author>
		<updated>2008-02-19T01:22:06-04:00</updated>

		<published>2008-02-19T01:22:06-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=80963#p80963</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=80963#p80963"/>
		<title type="html"><![CDATA[Explanation on File Reading?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=80963#p80963"><![CDATA[
Hi there, all. <br>I'm trying to go for a bit more dynamic scripts which are managing files and withdraws information from them. Although, I just can't seem to really understand how file managing works in Tcl. If anyone would be willing to help, it'd be great! What I need to know is:<ol style="list-style-type:decimal"><li>When do I need to open/close files? Let's say I want a file to be accessed whenever the bind is activated.</li><li>How do I tell it to access specific lines in a file?</li><li>How do I write one line to the last line in the file?</li></ol>Thanks in advance!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8949">dokueki</a> — Tue Feb 19, 2008 1:22 am</p><hr />
]]></content>
	</entry>
	</feed>
