Case are as follows:
Method a: reading the configuration file from the path
GetPrivateProfileString("parameter", "sourcefacespath", "NULL", strWindow.GetBuffer(1024), 1024, m_inipath);
//strWindow.ReleaseBuffer(1024); // add this one also get the file path in less than
CString m_folderPath = strWindow;
CString strWildCard =m_folderPath ;
strWildCard += "\\*.*";
Method two: direct assignment
CString m_folderPath ="\\\\192.168.1.132\\Users\\ZJS\\Desktop\\facesSample";
CString strWildCard =m_folderPath ;
strWildCard += "\\*.*";
The result: two methods can get the file from the path, and the method can not be;
Solution:
GetPrivateProfileString("parameter", "sourcefacespath", "NULL", strWindow.GetBuffer(1024), 1024, m_inipath);
strWindow.ReleaseBuffer (); // can not add the data length of brackets
Cause Analysis:
GetPrivateProfileString string length required for reading the profile string data, string length specified and often are greater than the actual length of the string, causing the string following problems when splicing, it is necessary to manually release the extra space characters (call ReleaseBuffer () method releases, junction brackets cut length data can be added, otherwise invalid)
These are their stories, and simple to understand, no in-depth research purposes, but want to experience the same situation peers can help.