<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://miniscript.org/w/index.php?action=history&amp;feed=atom&amp;title=FileHandle.atEnd</id>
	<title>FileHandle.atEnd - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://miniscript.org/w/index.php?action=history&amp;feed=atom&amp;title=FileHandle.atEnd"/>
	<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=FileHandle.atEnd&amp;action=history"/>
	<updated>2026-04-13T10:08:42Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.0</generator>
	<entry>
		<id>http://miniscript.org/w/index.php?title=FileHandle.atEnd&amp;diff=1313&amp;oldid=prev</id>
		<title>Redspark at 02:14, 30 January 2025</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=FileHandle.atEnd&amp;diff=1313&amp;oldid=prev"/>
		<updated>2025-01-30T02:14:10Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 02:14, 30 January 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l14&quot; &gt;Line 14:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 14:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	writer.writeLine line.upper&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	writer.writeLine line.upper&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;end while&amp;lt;/ms&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;end while&amp;lt;/ms&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Mini Micro]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=FileHandle.atEnd&amp;diff=624&amp;oldid=prev</id>
		<title>JoeStrout: Created page with &quot;The &lt;c&gt;atEnd&lt;/c&gt; method of the FileHandle class returns true after attempting to read past the end of the file.  Note that &lt;c&gt;atEnd&lt;/c&gt; is not true after the last successf...&quot;</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=FileHandle.atEnd&amp;diff=624&amp;oldid=prev"/>
		<updated>2021-01-09T18:27:37Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;The &amp;lt;c&amp;gt;atEnd&amp;lt;/c&amp;gt; method of the &lt;a href=&quot;/wiki/FileHandle&quot; title=&quot;FileHandle&quot;&gt;FileHandle&lt;/a&gt; class returns true after attempting to read past the end of the file.  Note that &amp;lt;c&amp;gt;atEnd&amp;lt;/c&amp;gt; is not true after the last successf...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;The &amp;lt;c&amp;gt;atEnd&amp;lt;/c&amp;gt; method of the [[FileHandle]] class returns true after attempting to read past the end of the file.&lt;br /&gt;
&lt;br /&gt;
Note that &amp;lt;c&amp;gt;atEnd&amp;lt;/c&amp;gt; is not true after the last successful read, nor is it true at the beginning of an empty file.  It only reports the condition that the last attempted read failed because there was no more data.  This is explained (in reference to the standard C function &amp;lt;c&amp;gt;feof&amp;lt;/c&amp;gt;) [https://stackoverflow.com/questions/34888776 here].&lt;br /&gt;
&lt;br /&gt;
For this reason, instead of using &amp;lt;c&amp;gt;atEnd&amp;lt;/c&amp;gt; in most cases, you should simply check for the [[FileHandle.read|read]] or [[FileHandle.readLine|readLine]] method to return [[null]], like so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;reader = file.open(&amp;quot;fileToRead.txt&amp;quot;, &amp;quot;r&amp;quot;)&lt;br /&gt;
writer = file.open(&amp;quot;fileToWrite.txt&amp;quot;, &amp;quot;w&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
// Copy the lines from one to the other, while changing to upper case.&lt;br /&gt;
while true&lt;br /&gt;
	line = reader.readLine&lt;br /&gt;
	if line == null then break&lt;br /&gt;
	writer.writeLine line.upper&lt;br /&gt;
end while&amp;lt;/ms&amp;gt;&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
</feed>