#include <Afxwin.h>
#include <Afxtempl.h>
void main()
{
CString l_strValue;
CArray<CString,CString> l_CArray;
for(int i=0;i< 20; i++)
{//Use the CString format function to create different values
l_strValue.Format("Value %d",i);
//Add the formatted CString to CArray
l_CArray.Add(l_strValue);}
}
#include <Afxwin.h>
#include <Afxtempl.h>
void main()
{
CString l_strValue;
CArray<CString,CString> l_CArray;
for(int i=0;i< 20; i++)
{//Use the CString format function to create different values
l_strValue.Format("Value %d",i);
//Add the formatted CString to CArray
l_CArray.Add(l_strValue);}
//This part takes care of accessing and printing the data from CArray
CString l_strGetVal;
for(i=0;i<=l_CArray.GetUpperBound();i++)
{
l_strGetVal = l_CArray.GetAt(i);
printf("%s\n",l_strGetVal);
}
}
l_CArray.RemoveAll() //This will remove all the elements from CArray
l_CArray.RemoveAt(10); //This will remove the 10th element from CArray
No comments:
Post a Comment