<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: 7.13 &#8212; Command line arguments</title>
	<atom:link href="http://www.learncpp.com/cpp-tutorial/713-command-line-arguments/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learncpp.com/cpp-tutorial/713-command-line-arguments/</link>
	<description></description>
	<pubDate>Fri, 29 Aug 2008 19:49:07 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Alex</title>
		<link>http://www.learncpp.com/cpp-tutorial/713-command-line-arguments/#comment-20692</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Fri, 11 Jul 2008 02:10:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/713-command-line-arguments/#comment-20692</guid>
		<description>argv is of type char *argv[], which is essentially a pointer to a pointer.

When we use the array index operator [] on a pointer/array, there is an implicit dereference that happens.  If argv is of type char *argv[], then argv[1] is of type char*, which is what we've declared pFilename as.</description>
		<content:encoded><![CDATA[<p>argv is of type char *argv[], which is essentially a pointer to a pointer.</p>
<p>When we use the array index operator [] on a pointer/array, there is an implicit dereference that happens.  If argv is of type char *argv[], then argv[1] is of type char*, which is what we&#8217;ve declared pFilename as.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Astro</title>
		<link>http://www.learncpp.com/cpp-tutorial/713-command-line-arguments/#comment-20646</link>
		<dc:creator>Astro</dc:creator>
		<pubDate>Thu, 10 Jul 2008 16:22:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/713-command-line-arguments/#comment-20646</guid>
		<description>Should &#34;char *pFilename = argv[1];&#34; in the example above be &#34;char *pFilename = &#38;argv[1];&#34; ???? 

Am I confusing myself here? </description>
		<content:encoded><![CDATA[<p>Should &quot;char *pFilename = argv[1];&quot; in the example above be &quot;char *pFilename = &amp;argv[1];&quot; ???? </p>
<p>Am I confusing myself here?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.learncpp.com/cpp-tutorial/713-command-line-arguments/#comment-17915</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Sat, 31 May 2008 00:36:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/713-command-line-arguments/#comment-17915</guid>
		<description>I think this has something to do with the way your program is doing character encoding.  TCHAR is a macro that can resolve to either char or wchar_t depending on whether or not you are using wide characters.  If you are using wide characters (wchar_t), then trying to use cout to print them will print addresses instead of values because it doesn't know how to handle them.  My guess is that _tmain() is converting your command line parameters to wide character strings, but main() isn't.</description>
		<content:encoded><![CDATA[<p>I think this has something to do with the way your program is doing character encoding.  TCHAR is a macro that can resolve to either char or wchar_t depending on whether or not you are using wide characters.  If you are using wide characters (wchar_t), then trying to use cout to print them will print addresses instead of values because it doesn&#8217;t know how to handle them.  My guess is that _tmain() is converting your command line parameters to wide character strings, but main() isn&#8217;t.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://www.learncpp.com/cpp-tutorial/713-command-line-arguments/#comment-16975</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Tue, 20 May 2008 00:21:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/713-command-line-arguments/#comment-16975</guid>
		<description>You have a GREAT site! I am using Visual Studio 2008 and it has been working great up until now.  If I use the built in "_tmain" declaration, I get 4 addresses printed. But when I use your declaration, it works perfect. What is the difference in the declarations?

&lt;pre&gt;
int _tmain(int argc, _TCHAR* argv[])
//int main(int argc, char *argv[])   
{   
    using namespace std;   
  
    cout &#60;&#60; "There are " &#60;&#60; argc &#60;&#60; " arguments:" &#60;&#60; endl;   
  
    // Loop through each argument and print its number and value   
    for (int nArg=0; nArg &#60; argc; nArg++)   
        cout &#60;&#60; nArg &#60;&#60; " " &#60;&#60; argv[nArg] &#60;&#60; endl;   
  
    return 0;   
}  
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>You have a GREAT site! I am using Visual Studio 2008 and it has been working great up until now.  If I use the built in &#8220;_tmain&#8221; declaration, I get 4 addresses printed. But when I use your declaration, it works perfect. What is the difference in the declarations?</p>
<pre>
int _tmain(int argc, _TCHAR* argv[])
//int main(int argc, char *argv[])
{
    using namespace std;   

    cout &lt;&lt; &#8220;There are &#8221; &lt;&lt; argc &lt;&lt; &#8221; arguments:&#8221; &lt;&lt; endl;   

    // Loop through each argument and print its number and value
    for (int nArg=0; nArg &lt; argc; nArg++)
        cout &lt;&lt; nArg &lt;&lt; &#8221; &#8221; &lt;&lt; argv[nArg] &lt;&lt; endl;   

    return 0;
}
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: kingyo</title>
		<link>http://www.learncpp.com/cpp-tutorial/713-command-line-arguments/#comment-10208</link>
		<dc:creator>kingyo</dc:creator>
		<pubDate>Sun, 23 Mar 2008 20:47:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/713-command-line-arguments/#comment-10208</guid>
		<description>Really nice job, helped me a lot...
Thank you!</description>
		<content:encoded><![CDATA[<p>Really nice job, helped me a lot&#8230;<br />
Thank you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: programmer in training</title>
		<link>http://www.learncpp.com/cpp-tutorial/713-command-line-arguments/#comment-9268</link>
		<dc:creator>programmer in training</dc:creator>
		<pubDate>Tue, 11 Mar 2008 06:43:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/cpp-tutorial/713-command-line-arguments/#comment-9268</guid>
		<description>I though the final example is suppose to be main(int argc, char *argc) instead of just int main()??

[ It is indeed.  -Alex ]</description>
		<content:encoded><![CDATA[<p>I though the final example is suppose to be main(int argc, char *argc) instead of just int main()??</p>
<p>[ It is indeed.  -Alex ]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
