加密后为什么后面有个?号.该如何解决
加密后为什么后面有个?号.
void jiami()
{flushall();
FILE *fpp;
int i=0,j;
char *p,t;
char shu[34];
char aa[100][200];
int maxline;
printf( "\n请输入您要加密的文件: ");
gets(shu);
int readdat();
if((fpp=fopen(shu, "r "))==NULL)
i=0;
while(fgets(aa[i],200,fpp)!=NULL)
{p=strchr(aa[i], '\n ');
if(p) *p=0;
i+=1;
}
maxline=i;
fclose(fpp);
for(i=0;i <maxline;i++)
{for(j=0;j <strlen(aa[i]);j++)
{
aa[i][j]+=126;
}
}
if((fpp=fopen(shu, "w "))==NULL)
i=0;
for(i=0;i <maxline;i++)
{
printf( "%s\n ",aa[i]);
fprintf(fpp, "%s \n ",aa[i]);
}
fclose(fpp);
}
// 程序可以正常运行..可是加密后 每行都有个?号.
或者其他的符合.
请高手帮忙看看哪里出了问题..谢谢..
------解决方案--------------------
fprintf(fpp, "%s \n ",aa[i]);
===============================================
%s后面不该有那个空格,去掉空格后,输出文件就没有 "? "了。
printf( "%s\n ",aa[i]);
========================
这样显示会把 '\n '算进去~
------解决方案--------------------
A_snail(蜗)(牛)VS.(钉)(子)
说的对
fprintf(fpp, "%s \n ",aa[i]);
===============================================
%s后面不该有那个空格,去掉空格后,输出文件就没有 "? "了。
void jiami()
{flushall();
FILE *fpp;
int i=0,j;
char *p,t;
char shu[34];
char aa[100][200];
int maxline;
printf( "\n请输入您要加密的文件: ");
gets(shu);
int readdat();
if((fpp=fopen(shu, "r "))==NULL)
i=0;
while(fgets(aa[i],200,fpp)!=NULL)
{p=strchr(aa[i], '\n ');
if(p) *p=0;
i+=1;
}
maxline=i;
fclose(fpp);
for(i=0;i <maxline;i++)
{for(j=0;j <strlen(aa[i]);j++)
{
aa[i][j]+=126;
}
}
if((fpp=fopen(shu, "w "))==NULL)
i=0;
for(i=0;i <maxline;i++)
{
printf( "%s\n ",aa[i]);
fprintf(fpp, "%s \n ",aa[i]);
}
fclose(fpp);
}
// 程序可以正常运行..可是加密后 每行都有个?号.
或者其他的符合.
请高手帮忙看看哪里出了问题..谢谢..
------解决方案--------------------
fprintf(fpp, "%s \n ",aa[i]);
===============================================
%s后面不该有那个空格,去掉空格后,输出文件就没有 "? "了。
printf( "%s\n ",aa[i]);
========================
这样显示会把 '\n '算进去~
------解决方案--------------------
A_snail(蜗)(牛)VS.(钉)(子)
说的对
fprintf(fpp, "%s \n ",aa[i]);
===============================================
%s后面不该有那个空格,去掉空格后,输出文件就没有 "? "了。