{"id":1158,"date":"2016-08-11T11:21:47","date_gmt":"2016-08-11T02:21:47","guid":{"rendered":"http:\/\/blog.box.kr\/?p=1158"},"modified":"2016-08-11T11:21:47","modified_gmt":"2016-08-11T02:21:47","slug":"c-how-to-handling-to-arguments","status":"publish","type":"post","link":"https:\/\/blog.box.kr\/?p=1158","title":{"rendered":"c++ how to handling to arguments"},"content":{"rendered":"<p>#include &lt;stdio.h&gt;<br \/>\n#include &lt;stdlib.h&gt; \u00a0\/\/ exit()<\/p>\n<p>int main(int argc, char* argv[]) {<\/p>\n<p>if (argc == 1) {<br \/>\nfputs(&#8220;Error no inputs..\\n&#8221;, stderr);<br \/>\nexit(1);<br \/>\n}<\/p>\n<p>\/\/ print\u00a0options count<br \/>\nprintf(&#8220;input count is \u00a0%d \\n\\n&#8221;, argc &#8211; 1);<\/p>\n<p>\/\/\u00a0print input arguments<br \/>\nfor (int i = 1; i &lt; argc; i++)<br \/>\nprintf(&#8220;argv[%d] = %s\\n&#8221;, i, argv[i]);<\/p>\n<p>return 0;<br \/>\n}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; \u00a0\/\/ exit() int main(int argc, char* argv[]) { if (argc == 1) { fputs(&#8220;Error no inputs..\\n&#8221;, stderr); exit(1); } \/\/ print\u00a0options count printf(&#8220;input count is \u00a0%d \\n\\n&#8221;, argc &#8211; 1); \/\/\u00a0print input arguments for (int i = 1; i &lt; argc; i++) printf(&#8220;argv[%d] = %s\\n&#8221;, i, argv[i]); return 0; }<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"ngg_post_thumbnail":0,"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[1],"tags":[],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5q9Zn-iG","jetpack-related-posts":[{"id":309,"url":"https:\/\/blog.box.kr\/?p=309","url_meta":{"origin":1158,"position":0},"title":"[MFC] &#8211; \uba54\ubaa8\ub9ac \uad00\ub828 \uc815\ubcf4 \ud68d\ub4dd","date":"2014-08-09","format":false,"excerpt":"GlobalMemoryStatus()\ud568\uc218\u00a0MSDN\u00a0\ucc38\uace0\u00a0\uc608\uc81c #include\u00a0<windows.h> #define\u00a0DIV\u00a01024 char\u00a0*divisor\u00a0=\u00a0\"K\"; void main(int\u00a0argc,\u00a0char\u00a0*argv[]) { MEMORYSTATUS\u00a0stat; GlobalMemoryStatus\u00a0(&stat); printf\u00a0(\"The\u00a0MEMORYSTATUS\u00a0structure\u00a0is\u00a0%ld\u00a0bytes\u00a0long.n\", \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0stat.dwLength); printf\u00a0(\"It\u00a0should\u00a0be\u00a0%d.n\",\u00a0sizeof\u00a0(stat)); printf\u00a0(\"There\u00a0is\u00a0%ld\u00a0percent\u00a0of\u00a0memory\u00a0in\u00a0use.n\", stat.dwMemoryLoad); printf\u00a0(\"There\u00a0are\u00a0%ld\u00a0total\u00a0%sbytes\u00a0of\u00a0physical\u00a0memory.n\", stat.dwTotalPhys\/DIV,\u00a0divisor); printf\u00a0(\"There\u00a0are\u00a0%ld\u00a0free\u00a0%sbytes\u00a0of\u00a0physical\u00a0memory.n\", stat.dwAvailPhys\/DIV,\u00a0divisor); printf\u00a0(\"There\u00a0are\u00a0%ld\u00a0total\u00a0%sbytes\u00a0of\u00a0paging\u00a0file.n\", stat.dwTotalPageFile\/DIV,\u00a0divisor); printf\u00a0(\"There\u00a0are\u00a0%ld\u00a0free\u00a0%sbytes\u00a0of\u00a0paging\u00a0file.n\", stat.dwAvailPageFile\/DIV,\u00a0divisor); printf\u00a0(\"There\u00a0are\u00a0%ld\u00a0total\u00a0%sbytes\u00a0of\u00a0virtual\u00a0memory.n\", stat.dwTotalVirtual\/DIV,\u00a0divisor); printf\u00a0(\"There\u00a0are\u00a0%ld\u00a0free\u00a0%sbytes\u00a0of\u00a0virtual\u00a0memory.n\", stat.dwAvailVirtual\/DIV,\u00a0divisor); }","rel":"","context":"In &quot;C\/C++&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":964,"url":"https:\/\/blog.box.kr\/?p=964","url_meta":{"origin":1158,"position":1},"title":"how to calculate duration time","date":"2015-08-26","format":false,"excerpt":"http:\/\/stackoverflow.com\/questions\/6734375\/c-boost-get-current-time-in-milliseconds \u00a0 int main(int argc, char* argv[]) { boost::posix_time::ptime t1 = boost::posix_time::second_clock::local_time(); boost::this_thread::sleep(boost::posix_time::millisec(500)); boost::posix_time::ptime t2 = boost::posix_time::second_clock::local_time(); boost::posix_time::time_duration diff = t2 - t1; std::cout << diff.total_milliseconds() << std::endl; boost::posix_time::ptime mst1 = boost::posix_time::microsec_clock::local_time(); boost::this_thread::sleep(boost::posix_time::millisec(500)); boost::posix_time::ptime mst2 = boost::posix_time::microsec_clock::local_time(); boost::posix_time::time_duration msdiff = mst2 - mst1; std::cout << msdiff.total_milliseconds() << std::endl; return 0;\u2026","rel":"","context":"In &quot;\uae30\uc220&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":178,"url":"https:\/\/blog.box.kr\/?p=178","url_meta":{"origin":1158,"position":2},"title":"std::map example","date":"2014-07-09","format":false,"excerpt":"\/\/ std::map example \/\/ opposite words #include <iostream> #include <map> #include <string> using namespace std; typedef std::map<std::string, std::string> TStrStrMap; typedef std::pair<std::string, std::string> TStrStrPair; int main(int argc, char *argv[]) { TStrStrMap tMap; tMap.insert(TStrStrPair(\"yes\", \"no\")); tMap.insert(TStrStrPair(\"up\", \"down\")); tMap.insert(TStrStrPair(\"left\", \"right\")); tMap.insert(TStrStrPair(\"good\", \"bad\")); std::string s; std::cout << \"Enter word: \" << std::endl;; std::cin >>\u2026","rel":"","context":"In &quot;C\/C++&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":228,"url":"https:\/\/blog.box.kr\/?p=228","url_meta":{"origin":1158,"position":3},"title":"MFC \/ C++\ub85c \ud2b9\uc815 \uc0ac\uc774\ud2b8 \uac00\uc838\uc640\uc11c \ubd84\uc11d \ud558\uae30 \uc18c\uc2a4","date":"2014-07-23","format":false,"excerpt":"#include <stdio.h> #include <windows.h> #include <wininet.h> #include <string> #include <comdef.h> #include <mshtml.h> #import <mshtml.tlb> no_auto_exclude #pragma comment(lib, \"wininet.lib\") #include <iostream> #include <fstream> using namespace std; int main(int argc, char* argv[]){ CoInitialize(NULL); ofstream dbfile (\"output.db\"); string sLI; string m_strURL; HINTERNET hOpen, hFile; MSHTML::IHTMLDocument2Ptr pDoc; HRESULT hr = CoCreateInstance(CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER, IID_IHTMLDocument2,\u2026","rel":"","context":"In &quot;C\/C++&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":505,"url":"https:\/\/blog.box.kr\/?p=505","url_meta":{"origin":1158,"position":4},"title":"[\ud38c] __cdecl, __pascal, __stdcall \uc758 \ucc28\uc774\uc5d0 \uad00\ud55c \uc815\ub9ac","date":"2014-12-26","format":false,"excerpt":"\ud568\uc218\ud638\ucd9c \ubc29\uc2dd\uc774 __cdecl, __pascal, __stdcall\ub85c \uc5ec\ub7ec \uac00\uc9c0\uac00 \uc788\ub294 \uc774\uc720\ub294 \uc708\ub3c4\uc6b0\uc988\uc758 \uc5ed\uc0ac\uc131\uc5d0 \uc788\ub2e4. \uc6b0\uc120 win16\uc5d0\uc11c\ub294 \uc2e4\ud589\ud30c\uc77c\uc758 \ud06c\uae30\uac00 \uc904\uc5b4\ub4e4\uace0 \uc18d\ub3c4\uac00 \ube60\ub974\ub2e4\ub294 \uc774\uc720\ub85c pascall \ubc29\uc2dd\uc744 \uc0ac\uc6a9 \ud588\uace0 win32\uc5d0\uc11c\ub294 \uac00\ubcc0\ub9e4\uac1c\uc778\uc790\ub97c \uc9c0\uc6d0\ud558\ub294 \ud568\uc218\ub97c \uc81c\uc678\ud55c \ubaa8\ub4e0 \ud568\uc218\ub4e4\uc740 __stdcall\uc744 \uc0ac\uc6a9 \ud55c\ub2e4. \ub9cc\uc57d c \ubc29\uc2dd\uc758 \ud568\uc218\ud638\ucd9c\uc744 \uc6d0\ud55c\ub2e4\uba74 __cdecl\uc744 \uba85\uc2dc\ud574 \uc8fc\uc5b4\uc57c \ud55c\ub2e4.(\uc708\ub3c4\uc6b0\uc988 \ud504\ub85c\uadf8\ub798\ubc0d\uc5d0 \uc788\uc5b4\uc11c) \uc6b0\uc120 c \ubc29\uc2dd\uc758 \ud568\uc218 \ud638\ucd9c\uacfc\u2026","rel":"","context":"In &quot;C\/C++&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":317,"url":"https:\/\/blog.box.kr\/?p=317","url_meta":{"origin":1158,"position":5},"title":"\ud55c\uae00 \ucd08\uc131\uc54c\uc544\ub0b4\uae30","date":"2014-08-09","format":false,"excerpt":"\uc6d0\uae00 :\u00a0http:\/\/ehclub.tistory.com\/entry\/%ED%95%9C%EA%B8%80-%EC%B4%88%EC%84%B1-%EC%95%8C%EC%95%84%EB%82%B4%EA%B8%B0 \u00a0 ===================================================================================================== \u00a0 \u3132, \u3138, \u3143, \u3146, \u3149 => \ucd94\uac00 ... const char *isarr[19] = {\"\u3131\",\"\u3132\",\"\u3134\",\"\u3137\",\"\u3138\",\"\u3139\",\"\u3141\",\"\u3142\",\"\u3143\",\"\u3145\",\"\u3146\",\"\u3147\",\"\u3148\",\"\u3149\",\"\u314a\",\"\u314b\",\"\u314c\",\"\u314d\",\"\u314e\"}; \u00a0 ===================================================================================================== \u00a0 \u00a0 \ud55c\uae00 \ucd08\uc131 \uc54c\uc544\ub0b4\uae30 \uc6d0\ub9ac\ub294 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4. (\uc9c0\uc2ddiN\uc9c8\ubb38 \ub2f5\ubcc0\ud558\ub2e4\uac00 \ub9cc\ub4e4\uc5b4 \ubd24\uc2b5\ub2c8\ub2e4.) \u00a0 \uc785\ub825 \ubb38\uc790\uc5f4\uc774 \"\uac00\"\ubcf4\ub2e4 \ud06c\uac70\ub098 \uac19\uace0\u00a0\"\ub098\"\ubcf4\ub2e4 \uc791\uc73c\uba74 \ucd08\uc131\uc740 \"\u3131\" \uc785\ub825 \ubb38\uc790\uc5f4\uc774 \"\ub098\"\ubcf4\ub2e4 \ud06c\uac70\ub098 \uac19\uace0\u00a0\"\ub098\"\ubcf4\ub2e4 \uc791\uc73c\uba74 \ucd08\uc131\uc740 \"\u3134\" \uc785\ub825\u2026","rel":"","context":"In &quot;C\/C++&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/blog.box.kr\/index.php?rest_route=\/wp\/v2\/posts\/1158"}],"collection":[{"href":"https:\/\/blog.box.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.box.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.box.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.box.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1158"}],"version-history":[{"count":1,"href":"https:\/\/blog.box.kr\/index.php?rest_route=\/wp\/v2\/posts\/1158\/revisions"}],"predecessor-version":[{"id":1159,"href":"https:\/\/blog.box.kr\/index.php?rest_route=\/wp\/v2\/posts\/1158\/revisions\/1159"}],"wp:attachment":[{"href":"https:\/\/blog.box.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.box.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.box.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}