{"id":801,"date":"2012-10-17T15:25:16","date_gmt":"2012-10-17T07:25:16","guid":{"rendered":"http:\/\/www.youthtribe.com\/?p=801"},"modified":"2014-07-31T08:16:26","modified_gmt":"2014-07-31T00:16:26","slug":"vc%e8%af%bb%e5%8f%96%e9%85%8d%e7%bd%ae%e6%96%87%e4%bb%b6ini%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"http:\/\/www.youthtribe.com\/archives\/801","title":{"rendered":"VC++\u8bfb\u53d6\u914d\u7f6e\u6587\u4ef6[ini]\u65b9\u6cd5-\u51fd\u6570"},"content":{"rendered":"
\u00a0\/\/\u5f97\u5148\u770b\u914d\u7f6e\u6587\u4ef6ini\u5b9a\u4e49\u4e86\u6ca1\uff0c\u5b9a\u4e49\u4e86\u8981\u53d6\u51fa\u5df2\u7ecf\u5b9a\u4e49\u7684\u503c\u7684
\nchar\u00a0\u00a0 szFileDir[120],codeseta[2];
\nCString inifilename,inifiledir;
\ninifilename=”\\\\youthtribe_com.ini”;\/\/<\/a>\u8fd9\u662f\u81ea\u5b9a\u4e49ini\u7684\u6587\u4ef6\u540d
\nGetCurrentDirectory(120,szFileDir);
\ninifiledir=szFileDir+inifilename;
\nCString fuck;
\n::GetPrivateProfileString(“CodeSet”,”m_ClassInCode1″,””,codeseta,10,inifiledir
\n);<\/p><\/blockquote>\n\u8fc7\u7a0b\u662f\uff1a\u5230\u5230ini\u6587\u4ef6\u7684\u7edd\u5bf9\u8def\u5f84\u3002\u7136\u540e\u7528API\u51fd\u6570 GetPrivateProfileString\uff0c\u8bfb\u53d6ini\u4e2d\u7684\u503c<\/p>\n
<\/p>\n
\u4e0b\u8fb9\u662f\u5199\u5165\u5230\u914d\u7f6e\u6587\u4ef6\uff1a\uff1a<\/p>\n
\u00a0\u00a0\/\/\u5c06\u53d8\u91cf\u4fdd\u5b58\u5230\u914d\u7f6e\u6587\u4ef6\uff0c\u8fd9\u6837\u4ee5\u540e\u8f6f\u4ef6\u542f\u52a8\u7684\u65f6\u5019\u5c31\u4e0d\u7528\u518d\u6b21\u4fee\u6539\u4e86<\/p>\n
char\u00a0\u00a0 szFileDir[120];
\nCString inifilename,inifiledir;
\ninifilename=”youthtribe_com.ini<\/a>“;<\/a>
\nGetCurrentDirectory(120,szFileDir);
\ninifiledir=szFileDir+inifilename;
\n\/\/\u8981\u5199\u5165\u5185\u5bb9
\nCString fieldName,strName,strValue;\/\/\u5b57\u6bb5\uff0c\u53d8\u91cf\u540d\uff0c
\nfieldName=”StudentInfo”;
\nstrName=”Name”;
\nstrValue=”\u767d\u6c5f\u6606\u5927\u738b”
\n\/\/\u5f00\u59cb\u5199\u5165
\n::WritePrivateProfileString(fieldName,strName,strValue,inifiledir);<\/p><\/blockquote>\n==========================================<\/p>\n
2014-03-20\uff0c\u81ea\u5df1\u6539\u5199\u7684\u51fd\u6570\uff0cGetIni,\u548cSetIni<\/p>\n
CString GetIni(CString strIniFileName,CString strSection,CString strKey,CString strFail,int nSize)\r\n{\r\n\tchar chExeDir[120];\/\/exe\u6587\u4ef6\u5939\u8def\u5f84\r\n\tchar chReturnStr[120];\r\n\tif(strFail.Getlength()==0)\r\n\t{\r\n\t\tstrFail = \"\u83b7\u53d6\"+strSection+\"\u8bbe\u7f6e\u5931\u8d25\";\r\n\t}\r\n\r\n\tCString strIniFileDir;\r\n\tGetCurrentDirectory(120,chExeDir);\r\n\r\n\tCString strExeDir;\r\n\tstrExeDir.Format(\"%s\",chExeDir);\r\n\r\n\tstrIniFileDir=strExeDir+\"\\\\\"+strIniFileName;\r\n\r\n\t::GetPrivateProfileString(strSection,strKey,strFail,chReturnStr,nSize,strIniFileDir);\r\n\r\n\tCString strReturn;\r\n\tstrReturn.Format(\"%s\",chReturnStr);\r\n\treturn strReturn;\r\n\r\n}<\/pre>\nSetIni,\u8fd9\u4e2a\u7b80\u5355\u4e9b<\/p>\n
void SetIni(CString strIniFileName,CString strSection,CString strKey,CString strValue)\r\n{\r\n\tchar chExeDir[120];\/\/exe\u6587\u4ef6\u5939\u8def\u5f84\r\n\r\n\tCString strIniFileDir;\r\n\tGetCurrentDirectory(120,chExeDir);\r\n\r\n\tCString strExeDir;\r\n\tstrExeDir.Format(\"%s\",chExeDir);\r\n\r\n\tstrIniFileDir=strExeDir+\"\\\\\"+strIniFileName;\r\n\r\n\t::WritePrivateProfileString(strSection,strKey,strValue,strIniFileDir);\t\r\n\r\n}<\/pre>\n<\/p>\n
<\/p>\n","protected":false},"excerpt":{"rendered":"
\u00a0\/\/\u5f97\u5148\u770b\u914d\u7f6e\u6587\u4ef6ini\u5b9a\u4e49\u4e86\u6ca1\uff0c\u5b9a\u4e49\u4e86\u8981\u53d6\u51fa\u5df2\u7ecf\u5b9a\u4e49\u7684\u503c\u7684 char\u00a0\u00a0 szFileDir[120],codeseta[2]; CString inifilename,inifiledir; inifilename=”\\\\youthtribe_com.ini”;\/\/\u8fd9\u662f\u81ea\u5b9a\u4e49ini\u7684\u6587\u4ef6\u540d GetCurrentDirectory(120,szFileDir); inifiledir=szFileDir+inifilename; CString fuck; ::GetPrivateProfileString(“CodeSet”,”<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1,9],"tags":[188,144,209,189],"_links":{"self":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/801"}],"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=801"}],"version-history":[{"count":9,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/801\/revisions"}],"predecessor-version":[{"id":804,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/801\/revisions\/804"}],"wp:attachment":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/media?parent=801"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/categories?post=801"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/tags?post=801"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}