CString数组赋值问题
CStringTextPath="C:\\Users\\Administrator\\Desktop\\第0步去噪\\configuration.txt";FILE*fa...
CString TextPath="C:\\Users\\Administrator\\Desktop\\第0步去噪\\configuration.txt";
FILE *fa = NULL;
fa = fopen(TextPath,"r+");
CString B = "0";
CString A1[2] = { 0 };
int i;
for (i = 0; i < 2; i++)
{
fscanf(fa,"%s\n",B);
A1[i] = B;
}
第一次循环是没有问题的,可以把B的内容赋值给A1[0],第二次循环就出问题了,B不仅把内容赋值给A1[1],还赋值给了A1[0]。请问是怎么回事~? 展开
FILE *fa = NULL;
fa = fopen(TextPath,"r+");
CString B = "0";
CString A1[2] = { 0 };
int i;
for (i = 0; i < 2; i++)
{
fscanf(fa,"%s\n",B);
A1[i] = B;
}
第一次循环是没有问题的,可以把B的内容赋值给A1[0],第二次循环就出问题了,B不仅把内容赋值给A1[1],还赋值给了A1[0]。请问是怎么回事~? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询