{"id":230,"date":"2010-04-29T17:22:53","date_gmt":"2010-04-29T17:22:53","guid":{"rendered":"https:\/\/ibex.tech\/visualcpp\/?p=230"},"modified":"2022-02-17T06:24:05","modified_gmt":"2022-02-17T06:24:05","slug":"getting-arguments-passed-to-the-application-exe","status":"publish","type":"post","link":"https:\/\/ibex.tech\/visualcpp\/application-control\/getting-arguments-passed-to-the-application-exe","title":{"rendered":"Getting Arguments Passed To The Application Exe"},"content":{"rendered":"<p>\/\/N.B. You can do this anywhere in the application &#8211; it doesn&#8217;t have to be in the main function.<\/p>\n<pre><code>\r\n\tarray&lt;String^&gt; ^arguments = Environment::GetCommandLineArgs();\r\n\tif (arguments != nullptr)\r\n\t{\r\n\t\tfor each (String ^argument in arguments)\r\n\t\t{\r\n\t\t\t\/\/CHECK THE NEXT ARGUMENT\r\n\t\t\t\/\/Note that if there we're no arguments you still get the exe filename \/ path as the first argument)\r\n\r\n\t\t\targument = argument-&gt;ToLower();\r\n\t\t\tif (argument-&gt;Contains(\".abc\"))\r\n\t\t\t{\r\n\t\t\t\t\/\/FILENAME HAS BEEN PASSED AS AN ARGUMENT SO OPEN THIS FILE\r\n\t\t\t\tCurrentFilename = argument;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\/\/N.B. You can do this anywhere in the application &#8211; it doesn&#8217;t have to be in the main function. array&lt;String^&gt; ^arguments = Environment::GetCommandLineArgs(); if (arguments != nullptr) { for each (String ^argument in arguments) { \/\/CHECK THE NEXT ARGUMENT \/\/Note that if there we&#8217;re no arguments you still get the exe filename \/ path as [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-230","post","type-post","status-publish","format-standard","hentry","category-application-control"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/230","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/comments?post=230"}],"version-history":[{"count":5,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/230\/revisions"}],"predecessor-version":[{"id":1121,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/230\/revisions\/1121"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/media?parent=230"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/categories?post=230"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/tags?post=230"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}