16,472
社区成员
发帖
与我相关
我的任务
分享
typedef vector<CStringArray> CStringArrayTwo;
void Cselpeopledlg::LoadFile(CString nFileName,CStringArrayTwo& arrtStr)//读取文件获取最近
{
//获取文件名
CString des=_T("");
TCHAR exeFullPath[MAX_PATH]; // MAX_PATH
GetModuleFileName(NULL,exeFullPath,MAX_PATH);
des=(LPCSTR)exeFullPath;
int n = des.ReverseFind('\\');
des = des.Left(n);
CString nFileFullName = des+_T("\\")+nFileName;
m_LoadFileName = nFileFullName;
//读文件
CString nLines = ReadFileByLine(RECENTLINES,m_LoadFileName);
m_szReadFileLineTexts = nLines;//保存读出各行的字符串到内部变量
//分割每行到数组
CStringArray arrStr;
CStringArray arrSubStr;
char str1 = _T('\n');
char str2 = _T('|');
n_slipt(m_szReadFileLineTexts,str1,arrStr);
for(int i=0;i<arrStr.GetCount();i++)
{
n_slipt(arrStr[i],str2,arrSubStr);
arrtStr.push_back(arrSubStr);
}
m_boIsLoadFile = TRUE;
}
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\include\afxcoll.h(590) : error C2248: 'CObject::CObject' : cannot access private member declared in class 'CObject'
// Disable the copy constructor and assignment by default so you will get
// compiler errors instead of unexpected behaviour if you pass objects
// by value or assign objects.
protected:
CObject();
private:
CObject(const CObject& objectSrc); // no implementation
void operator=(const CObject& objectSrc); // no implementation
class CStringArray : public CObject
{
DECLARE_SERIAL(CStringArray)
public:
// Construction
CStringArray();
// Attributes
INT_PTR GetSize() const;
INT_PTR GetCount() const;
BOOL IsEmpty() const;
INT_PTR GetUpperBound() const;
void SetSize(INT_PTR nNewSize, INT_PTR nGrowBy = -1);
// Operations
// Clean up
void FreeExtra();
void RemoveAll();
// Accessing elements
const CString& GetAt(INT_PTR nIndex) const;
void SetAt(INT_PTR nIndex, LPCTSTR newElement);
void SetAt(INT_PTR nIndex, const CString& newElement);
CString& ElementAt(INT_PTR nIndex);
// Direct Access to the element data (may return NULL)
const CString* GetData() const;
CString* GetData();
// Potentially growing the array
void SetAtGrow(INT_PTR nIndex, LPCTSTR newElement);
void SetAtGrow(INT_PTR nIndex, const CString& newElement);
INT_PTR Add(LPCTSTR newElement);
INT_PTR Add(const CString& newElement);
INT_PTR Append(const CStringArray& src);
void Copy(const CStringArray& src);
// overloaded operator helpers
const CString& operator[](INT_PTR nIndex) const;
CString& operator[](INT_PTR nIndex);
// Operations that move elements around
void InsertAt(INT_PTR nIndex, LPCTSTR newElement, INT_PTR nCount = 1);
void InsertAt(INT_PTR nIndex, const CString& newElement, INT_PTR nCount = 1);
void RemoveAt(INT_PTR nIndex, INT_PTR nCount = 1);
void InsertAt(INT_PTR nStartIndex, const CStringArray* pNewArray);
// Implementation
protected:
CString* m_pData; // the actual array of data
INT_PTR m_nSize; // # of elements (upperBound - 1)
INT_PTR m_nMaxSize; // max allocated
INT_PTR m_nGrowBy; // grow amount
void InsertEmpty(INT_PTR nIndex, INT_PTR nCount);
public:
~CStringArray();
void Serialize(CArchive&);
#ifdef _DEBUG
void Dump(CDumpContext&) const;
void AssertValid() const;
#endif
protected:
// local typedefs for class templates
typedef CString BASE_TYPE;
typedef LPCTSTR BASE_ARG_TYPE;
};