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

	<entry>
		<id>http://www.programmingexamples.net/w/index.php?title=CPP/IO/FileInput&amp;diff=132&amp;oldid=prev</id>
		<title>Nbaztec: /* FileInput.cpp */</title>
		<link rel="alternate" type="text/html" href="http://www.programmingexamples.net/w/index.php?title=CPP/IO/FileInput&amp;diff=132&amp;oldid=prev"/>
				<updated>2010-06-23T13:58:43Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;FileInput.cpp&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 13:58, 23 June 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 22:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 22:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;int main(int argc, char *argv[])&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;int main(int argc, char *argv[])&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; 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;&amp;#160; /*&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; 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;&amp;#160;  * Read the filename from the command-line argument.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; 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;&amp;#160;  * argv[0] is the EXE name&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; 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;&amp;#160;  */&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; std::string Filename = argv[1];&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; std::string Filename = argv[1];&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 37:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 41:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; int Integer;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; int Integer;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; 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;&amp;#160; //Create an input stream for file&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; std::ifstream fin(Filename.c_str());&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; std::ifstream fin(Filename.c_str());&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;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; 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;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; 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;&amp;#160;&amp;#160; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;/*&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; 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 class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#160;  * If our attempt to open the file has failed&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; 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 class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#160;  * then display error &amp;amp; exit returning -1 &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; 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 class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#160;  */&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; if(!fin )&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; if(!fin )&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; {&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; {&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; std::cout &amp;lt;&amp;lt; &amp;quot;File not found!&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; std::cout &amp;lt;&amp;lt; &amp;quot;File not found!&amp;quot; &amp;lt;&amp;lt; std::endl;&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;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; exit(-1);&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; 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;&amp;#160;&amp;#160; exit(-1); &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; }&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Nbaztec</name></author>	</entry>

	<entry>
		<id>http://www.programmingexamples.net/w/index.php?title=CPP/IO/FileInput&amp;diff=72&amp;oldid=prev</id>
		<title>Daviddoria: Created page with '==FileInput.cpp== &lt;source lang=&quot;cpp&quot;&gt; #include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;vector&gt; #include &lt;string&gt; #include &lt;sstream&gt; #include &lt;cstdlib&gt;  void ReadInt(const std::st…'</title>
		<link rel="alternate" type="text/html" href="http://www.programmingexamples.net/w/index.php?title=CPP/IO/FileInput&amp;diff=72&amp;oldid=prev"/>
				<updated>2010-06-23T12:24:59Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;#039;==FileInput.cpp== &amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt; #include &amp;lt;iostream&amp;gt; #include &amp;lt;fstream&amp;gt; #include &amp;lt;vector&amp;gt; #include &amp;lt;string&amp;gt; #include &amp;lt;sstream&amp;gt; #include &amp;lt;cstdlib&amp;gt;  void ReadInt(const std::st…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==FileInput.cpp==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;lt;fstream&amp;gt;&lt;br /&gt;
#include &amp;lt;vector&amp;gt;&lt;br /&gt;
#include &amp;lt;string&amp;gt;&lt;br /&gt;
#include &amp;lt;sstream&amp;gt;&lt;br /&gt;
#include &amp;lt;cstdlib&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void ReadInt(const std::string &amp;amp;Filename);&lt;br /&gt;
void ReadIntStringDouble(const std::string &amp;amp;Filename);&lt;br /&gt;
void VectorOfLines(const std::string &amp;amp;Filename);&lt;br /&gt;
void SkipComments(const std::string &amp;amp;Filename);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/* Example.txt&lt;br /&gt;
23&lt;br /&gt;
test&lt;br /&gt;
4.5&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char *argv[])&lt;br /&gt;
{&lt;br /&gt;
  std::string Filename = argv[1];&lt;br /&gt;
&lt;br /&gt;
  ReadInt(Filename);&lt;br /&gt;
  //ReadIntStringDouble(Filename);&lt;br /&gt;
  //VectorOfLines(Filename);&lt;br /&gt;
  //SkipComments(Filename);&lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void ReadInt(const std::string &amp;amp;Filename)&lt;br /&gt;
{&lt;br /&gt;
  std::cout &amp;lt;&amp;lt; &amp;quot;Filename: &amp;quot; &amp;lt;&amp;lt; Filename &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
&lt;br /&gt;
  int Integer;&lt;br /&gt;
&lt;br /&gt;
  std::ifstream fin(Filename.c_str());&lt;br /&gt;
  &lt;br /&gt;
  if(!fin )&lt;br /&gt;
  {&lt;br /&gt;
  std::cout &amp;lt;&amp;lt; &amp;quot;File not found!&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
  exit(-1);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  std::string line;&lt;br /&gt;
  std::stringstream linestream;&lt;br /&gt;
	  &lt;br /&gt;
  getline(fin, line);&lt;br /&gt;
  linestream.clear();&lt;br /&gt;
  linestream &amp;lt;&amp;lt; line;&lt;br /&gt;
  linestream &amp;gt;&amp;gt; Integer;	&lt;br /&gt;
&lt;br /&gt;
  fin.close();&lt;br /&gt;
&lt;br /&gt;
  std::cout &amp;lt;&amp;lt; &amp;quot;Integer: &amp;quot; &amp;lt;&amp;lt; Integer &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void ReadIntStringDouble(const std::string &amp;amp;Filename)&lt;br /&gt;
{&lt;br /&gt;
  std::cout &amp;lt;&amp;lt; &amp;quot;Filename: &amp;quot; &amp;lt;&amp;lt; Filename &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
&lt;br /&gt;
  int Integer;&lt;br /&gt;
  std::string String;	&lt;br /&gt;
  double Double;&lt;br /&gt;
&lt;br /&gt;
  std::ifstream fin(Filename.c_str());&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  if(fin == NULL)&lt;br /&gt;
  {	&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; &amp;quot;Cannot open file.&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  std::string line;&lt;br /&gt;
  std::stringstream linestream;&lt;br /&gt;
	  &lt;br /&gt;
  getline(fin, line);&lt;br /&gt;
  linestream.clear();&lt;br /&gt;
  linestream &amp;lt;&amp;lt; line;&lt;br /&gt;
  linestream &amp;gt;&amp;gt; Integer;	&lt;br /&gt;
&lt;br /&gt;
  getline(fin, line);&lt;br /&gt;
  linestream.clear();&lt;br /&gt;
  linestream &amp;lt;&amp;lt; line;&lt;br /&gt;
  linestream &amp;gt;&amp;gt; String;&lt;br /&gt;
&lt;br /&gt;
  getline(fin, line);&lt;br /&gt;
  linestream.clear();&lt;br /&gt;
  linestream &amp;lt;&amp;lt; line;&lt;br /&gt;
  linestream &amp;gt;&amp;gt; Double;&lt;br /&gt;
&lt;br /&gt;
  fin.close();&lt;br /&gt;
&lt;br /&gt;
  std::cout &amp;lt;&amp;lt; &amp;quot;Integer: &amp;quot; &amp;lt;&amp;lt; Integer &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
  std::cout &amp;lt;&amp;lt; &amp;quot;String: &amp;quot; &amp;lt;&amp;lt; String &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
  std::cout &amp;lt;&amp;lt; &amp;quot;Double: &amp;quot; &amp;lt;&amp;lt; Double &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void VectorOfLines(const std::string &amp;amp;Filename)&lt;br /&gt;
{&lt;br /&gt;
	&lt;br /&gt;
  std::ifstream fin(Filename.c_str());&lt;br /&gt;
&lt;br /&gt;
  if(fin == NULL)&lt;br /&gt;
  {&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; &amp;quot;Cannot open file.&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  std::vector&amp;lt;std::string&amp;gt; Lines;&lt;br /&gt;
  std::string line;&lt;br /&gt;
  &lt;br /&gt;
  while(getline(fin, line))&lt;br /&gt;
  {&lt;br /&gt;
    Lines.push_back(line);&lt;br /&gt;
  }&lt;br /&gt;
	&lt;br /&gt;
  for(unsigned int i = 0; i &amp;lt; Lines.size(); i++)&lt;br /&gt;
  {&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; Lines[i] &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void SkipComments(const std::string &amp;amp;Filename)&lt;br /&gt;
{&lt;br /&gt;
  /* test.txt&lt;br /&gt;
  P3&lt;br /&gt;
  # example comment&lt;br /&gt;
  512 512&lt;br /&gt;
  255&lt;br /&gt;
&lt;br /&gt;
  */&lt;br /&gt;
  std::ifstream fin(Filename.c_str());&lt;br /&gt;
&lt;br /&gt;
  if(fin == NULL)&lt;br /&gt;
  {&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; &amp;quot;Cannot open file.&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  char MV[2];//the first 2 ascii values&lt;br /&gt;
  int width, height;&lt;br /&gt;
  int MPV;//max pixel value&lt;br /&gt;
&lt;br /&gt;
  std::string line;&lt;br /&gt;
	  &lt;br /&gt;
  getline(fin, line); //get first line&lt;br /&gt;
	  &lt;br /&gt;
  MV[0] = line[0];&lt;br /&gt;
  MV[1] = line[1];&lt;br /&gt;
  std::cout &amp;lt;&amp;lt; &amp;quot;MV[0] = &amp;quot; &amp;lt;&amp;lt; MV[0] &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
  std::cout &amp;lt;&amp;lt; &amp;quot;MV[1] = &amp;quot; &amp;lt;&amp;lt; MV[1] &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
  &lt;br /&gt;
  line = &amp;quot;&amp;quot;;&lt;br /&gt;
  getline(fin, line); //get second line&lt;br /&gt;
  std::string FirstChar = line.substr(0, 1);&lt;br /&gt;
&lt;br /&gt;
  if(FirstChar == &amp;quot;#&amp;quot;)&lt;br /&gt;
  {&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; &amp;quot;Skipped this line.&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  line = &amp;quot;&amp;quot;;&lt;br /&gt;
  getline(fin, line); //get third line&lt;br /&gt;
  std::stringstream LineStream;&lt;br /&gt;
  LineStream &amp;lt;&amp;lt; line;&lt;br /&gt;
  LineStream &amp;gt;&amp;gt; width &amp;gt;&amp;gt; height;&lt;br /&gt;
  std::cout &amp;lt;&amp;lt; &amp;quot;Width = &amp;quot; &amp;lt;&amp;lt; width &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
  std::cout &amp;lt;&amp;lt; &amp;quot;Height = &amp;quot; &amp;lt;&amp;lt; height &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
  LineStream.str(&amp;quot;&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  line = &amp;quot;&amp;quot;;&lt;br /&gt;
  getline(fin, line); //get fourth line&lt;br /&gt;
	  &lt;br /&gt;
  LineStream.str(&amp;quot;&amp;quot;);&lt;br /&gt;
  LineStream.clear();&lt;br /&gt;
  LineStream &amp;lt;&amp;lt; line;&lt;br /&gt;
  LineStream &amp;gt;&amp;gt; MPV;&lt;br /&gt;
	  &lt;br /&gt;
  std::cout &amp;lt;&amp;lt; &amp;quot;MPV = &amp;quot; &amp;lt;&amp;lt; MPV &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
  &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daviddoria</name></author>	</entry>

	</feed>