<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://programmingexamples.net/w/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://programmingexamples.net/w/index.php?action=history&amp;feed=atom&amp;title=CPP%2FIO%2FReadingLines</id>
		<title>CPP/IO/ReadingLines - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://programmingexamples.net/w/index.php?action=history&amp;feed=atom&amp;title=CPP%2FIO%2FReadingLines"/>
		<link rel="alternate" type="text/html" href="http://programmingexamples.net/w/index.php?title=CPP/IO/ReadingLines&amp;action=history"/>
		<updated>2026-06-13T14:32:25Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.5</generator>

	<entry>
		<id>http://programmingexamples.net/w/index.php?title=CPP/IO/ReadingLines&amp;diff=147&amp;oldid=prev</id>
		<title>Galik: Created page with '==ReadLines.cpp== &lt;source lang=&quot;cpp&quot;&gt; #include &lt;string&gt; #include &lt;fstream&gt; #include &lt;iostream&gt;  int main() { 	// Open file for input 	std::ifstream ifs(&quot;input.txt&quot;);  	std::strin…'</title>
		<link rel="alternate" type="text/html" href="http://programmingexamples.net/w/index.php?title=CPP/IO/ReadingLines&amp;diff=147&amp;oldid=prev"/>
				<updated>2010-06-23T20:12:09Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;#039;==ReadLines.cpp== &amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt; #include &amp;lt;string&amp;gt; #include &amp;lt;fstream&amp;gt; #include &amp;lt;iostream&amp;gt;  int main() { 	// Open file for input 	std::ifstream ifs(&amp;quot;input.txt&amp;quot;);  	std::strin…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==ReadLines.cpp==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;string&amp;gt;&lt;br /&gt;
#include &amp;lt;fstream&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
	// Open file for input&lt;br /&gt;
	std::ifstream ifs(&amp;quot;input.txt&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	std::string line; // string to contain each line&lt;br /&gt;
&lt;br /&gt;
	// By placing the getline() function&lt;br /&gt;
	// inside the while condition you&lt;br /&gt;
	// guarantee that inside the loop&lt;br /&gt;
	// the read was successful and that line is valid.&lt;br /&gt;
	while(std::getline(ifs, line))&lt;br /&gt;
	{&lt;br /&gt;
		// deal with each line here...&lt;br /&gt;
		std::cout &amp;lt;&amp;lt; line &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Galik</name></author>	</entry>

	</feed>