为什么我的下面的代码输出乱码:
    length=sqrt(((*it).first .x-(*it).second .x)*((*it).first .x-(*it).second .x)+((*it).first .y - (*it).second .y )*((*it).first .y -(*it).second .y ));
        lengths.push_back (length);
CString msg,msg1,msg2;
    msg1.Format ("%d",length);
msg2.Format ("%d",count2);
msg="A"+msg2;
msg=msg+"=";
                msg=msg+msg1;
++count2;
    TextOut(dc,((*it).first .x +(*it).second .x)/2,((*it).first .y +(*it).second .y )/2,msg,sizeof(msg));
只能够输出A0=  ,A1=   ,等,后面的那个长度就没有了,所以我分两次输出,像下面的这样写:
    length=sqrt(((*it).first .x-(*it).second .x)*((*it).first .x-(*it).second .x)+((*it).first .y -(*it).second .y )*((*it).first .y -(*it).second .y ));
        lengths.push_back (length);
CString msg,msg1,msg2;
    msg1.Format ("%d",length);
msg2.Format ("%d",count2);
msg="A"+msg2;
msg=msg+"=";

++count2;
    TextOut(dc,((*it).first .x +(*it).second .x)/2,((*it).first .y +(*it).second .y )/2,msg,sizeof(msg));
        TextOut(dc,((*it).first .x +(*it).second .x+50)/2,((*it).first .y +(*it).second .y )/2,msg1,sizeof(msg1));
就可以了,但是有时候数据好像会出现这样的情况:
本来应该显示的是A2=318,结果却是A2=318C,那个C上面还有一个斜线,这个字符我打不出来,截图出来也发现帖子上面贴不了,有时候还会带2个那样类C的字符。请问是什么原因???还有这段代码:
CClientDC dc(this);
int i=0;
for( ;i<Nodnum;++i)
{
CString str1,str2,str3,str4;
str1.Format ("%d",i);
str1="e("+str1; str2.Format ("%d",ve[i]);
str3.Format ("%d",vl[i]);
str2=")="+str2;
str3=","+str3;
TextOut(dc,10,i*20,str1,sizeof(str1));
TextOut(dc,10+sizeof(str1)+30,i*20,str2,sizeof(str2));
TextOut(dc,10+sizeof(str1)+sizeof(str2)+60,i*20,str3,sizeof(str3-1));
本来要输出的是类似这样的:e(1)=3,3的,那个后面的那个3却输出不来了,估计也是跟上面的代码一样的错误????