Q:

How to convert a CPoint object into a string?

I have a std::array of CPoint objects which I want to output in an mfc application:
std::array<CPoint,11> v = pDoc->m_ElementList.back();

    for(int j=0;   j < v.size();  j++ )
        aDC.TextOutW(x+=3,y+=3, _T(v[n++]));   

Now _T(v[n++]) obviously doesn't work since it's a CPoint object, not a string. How can I output CPoint objects in this way? Or how can I convert them into strings to use them in such a way?

A:

CString s;
CPoint p;

s.Format("x=%d / y=%d",p.x,p.y);

For a std::string use either sprintf or a std::stringstream.
stringstream ss;
ss << "x=" << p.x << "/" << "y=" << "p.y";

