代码:
FILE *file;
//打开文件
file = fopen(write_strFileName,"w");
//关闭文件
fclose(file);
CHAR a1[10];
CHAR b1[10];
//StringCchPrintf(a1,10,"%d",(UINT)player_Pos1.size());
//WritePrivateProfileString("坦克将要走的位置","Mesh",a1,write_strFileName);
for (size_t ix = 0;ix < player_Pos1.size();++ix)
{
//X的位置
StringCchPrintf(a1,10,"mesh_%dX",(UINT)ix);
StringCchPrintf(b1,10,"%d",(UINT)player_Pos1[ix].x);
WritePrivateProfileString("坦克将要走的位置",a1,b1,write_strFileName);
//Y的位置
StringCchPrintf(a1,10,"mesh_%dY",(UINT)ix);
StringCchPrintf(b1,10,"%d",(UINT)player_Pos1[ix].y);
WritePrivateProfileString("坦克将要走的位置",a1,b1,write_strFileName);
//Z的位置
StringCchPrintf(a1,10,"mesh_%dZ",(UINT)ix);
StringCchPrintf(b1,10,"%d",(UINT)player_Pos1[ix].z);
WritePrivateProfileString("坦克将要走的位置",a1,b1,write_strFileName);
}
上面代码输出的结果为:
[坦克将要走的位置]
mesh_0X=10
mesh_0Y=14
mesh_0Z=-442
mesh_1X=6
mesh_1Y=14
mesh_1Z=-444
mesh_2X=7
mesh_2Y=12
mesh_2Z=-457
如何把上面多余的字符去掉
我想要的结果为:
10
14
-442
6
14
-444
7
12
-457