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

	<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-08-21T17:49:18-04:00</updated>

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

		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2007-08-21T17:49:18-04:00</updated>

		<published>2007-08-21T17:49:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75434#p75434</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75434#p75434"/>
		<title type="html"><![CDATA[Basic File Operations]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75434#p75434"><![CDATA[
You sure it only read 1 line?  How are you trying to determine what's in the $data var after reading in the file?  <br><br>If you do:<div class="codebox"><p>Code: </p><pre><code>foreach line [split $data \n] {                putcmdlog "line '$line'"}</code></pre></div>you should see all of the data and some blank lines?<br><br>When I read/write to files, I check for blank lines and exclude them along the way:<br><div class="codebox"><p>Code: </p><pre><code># read data inif {![file exists $quotefile]} {return "No quotes available."}set quotelines ""set inqfile [open $quotefile r]set quotetemp [split [read $inqfile] \n]catch {close $inqfile}foreach line $quotetemp {if {$line != ""} {lappend quotelines $line}}</code></pre></div><div class="codebox"><p>Code: </p><pre><code># write data outset quotewrite [open $quotefile w]foreach line $quotelines {set line [string trim $line]if {$line != ""} {puts $quotewrite $line}}catch {close $quotewrite}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Tue Aug 21, 2007 5:49 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Gust]]></name></author>
		<updated>2007-08-21T14:07:52-04:00</updated>

		<published>2007-08-21T14:07:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=75432#p75432</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=75432#p75432"/>
		<title type="html"><![CDATA[Basic File Operations]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=75432#p75432"><![CDATA[
OK, very old topic but still problems...<br><br>With the code for reading a whole file:<div class="codebox"><p>Code: </p><pre><code>set fname "textfile.txt"set fp [open $fname "r"]set data [read -nonewline $fp] close $fpset lines [split $data "\n"]</code></pre></div>my bot just reads the first line... <br><br>How to solve that?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7913">Gust</a> — Tue Aug 21, 2007 2:07 pm</p><hr />
]]></content>
	</entry>
	</feed>
