시저암호 코드 질문입니다.
푸른들
#define _CRT_SECURE_NO_DEPRECATE
#include stdio.h
int main()
{
int state;
char buf[17];
char addbuf[17];
int i;
FILE *fp, *fp_r;
fp = fopen(Information.txt, wt);
if(fp==NULL) {
printf(open error\n);
return 1;
}
fputs(iloveKOREAuniv, fp);
state=fclose(fp);
if(state!=0) {
printf(close error\n);
return 1;
}
fp_r=fopen(Information.txt, rt);
if(fp=NULL) {
printf(open error);
return 1;
}
while(!feof(fp_r)){
fgets(buf, 16, fp_r);
}
printf(원본 : );
for(i=0; i16; i++)
printf(%c, buf[i]);
printf(\n);
state=fclose(fp_r);
if(state!=0) {
printf(close error\n);
return 1;
}
fp=fopen(Information_D.txt, wt);
if(fp=NULL) {
printf(open error);
return 1;
}
for(i=0; i16; i++) {
addbuf[i] = buf[i]+4;
}
printf(암호화 : );
for(i=0; i16; i++)
printf(%c, addbuf[i]);
printf(\n);
state=fclose(fp);
if(state!=0) {
printf(close error\n);
return 1;
}
return 0;
}
화면에는 나오는데 암호화된 문장이 파일에 저장이 안됩니다.;;;
fputs 사용하는 건가요??
해결책좀;;;
그리고 실행하면 오류가 나오는데 debug assertion failed라고 나오네요;;
program:...
fclose.c
stream=! NULL 이렇게요;;
원인및 해결책이무엇인지 궁금합니다.
파일연것은 다 종결했는데요;;