{"id":1369,"date":"2014-10-13T14:15:38","date_gmt":"2014-10-13T06:15:38","guid":{"rendered":"http:\/\/www.youthtribe.com\/?p=1369"},"modified":"2018-10-27T04:02:31","modified_gmt":"2018-10-26T20:02:31","slug":"mfc-vc-%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8%e6%ad%a3%e5%88%99%e8%bf%87%e6%bb%a4%e5%87%bd%e6%95%b0","status":"publish","type":"post","link":"http:\/\/www.youthtribe.com\/archives\/1369","title":{"rendered":"mfc-vc++-\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8fc7\u6ee4\u51fd\u6570"},"content":{"rendered":"

\u8fd9\u4e2a\u51fd\u6570\u53ef\u4ee5\u6b63\u5219\u5339\u914d<\/strong>\u51fa\u4e00\u6bb5\u6587\u672c\uff0c\u6bd4\u5982\u6211\u4eec\u83b7\u53d6\u4e86\u4e00\u4e2a\u7f51\u7ad9\u7684\u4e00\u4e2a\u9875\u9762\u7684txet\u6587\u672c\u540e\uff0c\u53ef\u4ee5\u5229\u7528\u672c\u51fd\u6570\u65b9\u4fbf\u7684\u53d6\u51fa\u6211\u4eec\u60f3\u8981\u7684\u76ee\u6807\u5b57\u6bb5\uff0c\u6bd4\u5982\uff0c\u8fd9\u4e2a\u9875\u9762\u7684title,keywords,\u7b49\u76ee\u6807\u5143\u7d20\u3002<\/p>\n

\u8981\u4f7f\u7528\u6b64\u51fd\u6570\uff0c\u9700\u8981\u4f60\u7684vc\u5de5\u7a0b\u662fvs2010\u4ee5\u4e0a\u7248\u672c\uff08\u4ece2010\u7248\u672c\u5f00\u59cb\uff0c\u5fae\u8f6f\u624d\u5185\u7f6e\u4e86\u201cregex.h\u201d\u7684\uff09\uff0c\u9996\u5148\u5305\u542b\u5934\u6587\u4ef6<\/p>\n

\r\n#include <regex>\r\n\r\n\r\n\u51fd\u6570\u5f00\u59cb\r\n\r\n\/\/ \u8fd9\u662f\u4e00\u4e2a\u5339\u914dstrBegin\u548cstrEnd\u4e4b\u95f4\u5b57\u7b26\u4e32\u7684\u51fd\u6570\r\n\/\/str,\u6307\u5b9a\u8981\u67e5\u627e\u7684\u5b57\u7b26\u4e32\r\n\/\/strBegin,\u6307\u5b9a\u5f00\u59cb\u5904\u7684\u5b57\u7b26\u4e32\r\n\/\/strEnd\uff0c\u6307\u5b9a\u7ed3\u5c3e\u5904\u7684\u5b57\u7b26\u4e32\r\n\/\/\u957f\u5ea6\u4e3a0\uff0c\u8bf4\u660e\u6ca1\u6709\u5339\u914d\u6210\u529f\r\n\r\n\r\nCString CConfigureDlg::GetMatchCString(CString strSearch, CString strBegin, CString strEnd)\r\n{\r\nCString strReturn;\r\n\/\/CString->string\r\nstd::string str(strSearch.GetBuffer());\r\n\/\/\u6b63\u5219\u89c4\u5219\r\nstd::string strbegin,strend,strreg;\r\nstrbegin = strBegin.GetBuffer();\r\nstrend = strEnd.GetBuffer();\r\nstrreg = \"(.*?)\";\r\nstrreg = strbegin + strreg + strend;\r\nstd::regex reg(strreg);\r\n\/\/\u5b58\u653e\u5339\u914d\u51fa\u6765\u5b57\u7b26\u4e32\r\nstd::match_results<std::string::const_iterator> mr;\r\n\r\n\r\nif (std::regex_search(str,mr,reg))\r\n{\r\nstd::string s(mr.str());\r\n\/\/CString strURL;\r\nstrReturn = s.c_str();\r\n\/\/\u53bb\u6389\u524d\u540e\u4e24\u4e2a\u6807\u8bc6\u7b26\r\nstrReturn.Replace(strBegin,\"\");\r\nstrReturn.Replace(strEnd,\"\");\r\n}\r\nreturn strReturn;\r\nreturn CString();\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"

\u8fd9\u4e2a\u51fd\u6570\u53ef\u4ee5\u6b63\u5219\u5339\u914d\u51fa\u4e00\u6bb5\u6587\u672c\uff0c\u6bd4\u5982\u6211\u4eec\u83b7\u53d6\u4e86\u4e00\u4e2a\u7f51\u7ad9\u7684\u4e00\u4e2a\u9875\u9762\u7684txet\u6587\u672c\u540e\uff0c\u53ef\u4ee5\u5229\u7528\u672c\u51fd\u6570\u65b9\u4fbf\u7684\u53d6\u51fa\u6211\u4eec\u60f3\u8981\u7684\u76ee\u6807\u5b57\u6bb5\uff0c\u6bd4\u5982\uff0c\u8fd9\u4e2a\u9875\u9762\u7684title,keywords,\u7b49\u76ee\u6807\u5143\u7d20\u3002 \u8981\u4f7f\u7528\u6b64\u51fd\u6570\uff0c\u9700\u8981\u4f60\u7684vc\u5de5\u7a0b\u662fvs2010\u4ee5\u4e0a\u7248\u672c\uff08\u4ece2010\u7248\u672c\u5f00\u59cb\uff0c\u5fae\u8f6f\u624d\u5185\u7f6e\u4e86\u201cregex.h\u201d\u7684\uff09\uff0c\u9996\u5148\u5305\u542b\u5934\u6587\u4ef6 #include <regex> \u51fd\u6570\u5f00\u59cb \/\/ \u8fd9\u662f\u4e00\u4e2a\u5339\u914dstrBegin\u548cstrEnd\u4e4b\u95f4\u5b57\u7b26\u4e32\u7684\u51fd\u6570 \/\/str,\u6307\u5b9a\u8981\u67e5\u627e\u7684\u5b57\u7b26\u4e32 \/\/strBegin,\u6307\u5b9a\u5f00\u59cb\u5904\u7684\u5b57\u7b26\u4e32 \/\/strEnd\uff0c\u6307\u5b9a\u7ed3\u5c3e\u5904\u7684\u5b57\u7b26\u4e32 \/\/\u957f\u5ea6\u4e3a0\uff0c\u8bf4\u660e\u6ca1\u6709\u5339\u914d\u6210\u529f CString CCo<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1,219,9],"tags":[],"_links":{"self":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/1369"}],"collection":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/comments?post=1369"}],"version-history":[{"count":10,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/1369\/revisions"}],"predecessor-version":[{"id":1764,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/1369\/revisions\/1764"}],"wp:attachment":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/media?parent=1369"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/categories?post=1369"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/tags?post=1369"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}