主题 : sprintf 求解 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 38955
精华: 0
发帖: 8
金钱: 40 两
威望: 8 点
综合积分: 16 分
注册时间: 2011-03-03
最后登录: 2011-03-11
楼主  发表于: 2011-03-11 10:54

 sprintf 求解

printf("info[%d].m_nValue=%f\n",i,info.m_nValue);
printf("info[%d].m_fLastPV=%f\n",i,info.m_fLastPV);
  printf("info[%d].m_nPointId=%d\n",i,info.m_nPointId);
sprintf(strA,"update simulatedpoint set pv=%f , LastPV=%f where ID=%d ",info.m_nValue,info.m_fLastPV,info.m_nPointId);
printf("strA=%s\n",strA);

运行结果:
info[0].m_nValue=1744.000000
info[0].m_fLastPV=14.000000
info[0].m_nPointId=1
strA=update simulatedpoint set pv=0.000000 , LastPV=0.000000 where ID=2

我想要的结果是:
strA=update simulatedpoint set pv=1744.000000, LastPV=14.000000 where ID=2