显示此符号╠,而不显示所需的字符 [英] Displaying this symbol ╠ instead of desired characters
本文介绍了显示此符号╠,而不显示所需的字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是一些代码的片段.不会显示我要检查的字符,而是显示╠.
Here is a snippet of some code. Instead of displaying the characters I am checking for, ╠ is displayed.
while (c!= EOF)
{
c = getc(fp);
if (c==32 || c==33 || (c>=97 && c<=122) || c==35)
j++;
if(j==clns){
i++;
j=0;
mA[i][j]=c;
}
}
for (i = 0; i < 10; i++) {
for (j = 0; j < 20; j++) {
printf("%c", mA[i][j]);
}
printf("%c\n", mA[i][j]);
}
在此先感谢您的帮助. :)
Thanks in advance for your help. :)
推荐答案
您只写过mA[i][0]
:
if(j==clns){
i++;
j=0;
mA[i][j]=c;
}
因此,您正在打印碰巧在数组中的随机垃圾.将任务移出if
.
so you are printing random garbage that happened to be in the array. Move the assignment out of the if
.
这篇关于显示此符号╠,而不显示所需的字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文