在程序中例,
for(POSITION pos1=m_List.GetHeadPosition();pos1!=NULL;)m_list是一个类的链表,就是m_list中的成员是类,我想将pos1转换为CString字符串,用来和另一字符串比较,不知有什么方法转换,我用了一个最差的方法,将pos1的值输出到文件,outfile<<pos1,再从文件中读出来,file.read(),就能转换成CString了,我想问一下有什么好办法?
for(POSITION pos1=m_List.GetHeadPosition();pos1!=NULL;)m_list是一个类的链表,就是m_list中的成员是类,我想将pos1转换为CString字符串,用来和另一字符串比较,不知有什么方法转换,我用了一个最差的方法,将pos1的值输出到文件,outfile<<pos1,再从文件中读出来,file.read(),就能转换成CString了,我想问一下有什么好办法?
memcpy(&str,&pos1,sizeof(POSITION));
memcpy(&str,&socket1,sizeof(CSocket)); ????
//填充
CString str;
for(int i = 0; i <10; i++)
{
str.Format("%d", i);
m_List.AddTail(str);
}
//遍历
POSITION pos1 = NULL;
CString sIteration;
while( NULL != (pos1=m_List.GetHeadPosition()) )
{
sIteration = m_List.GetNext(pos1);
if(sIteration == "Your Specify String")
{// do anything
...
}
}