파일입출력 실행오류 문제
반월
2023.04.01
아래와같이 프로그래밍하고 실행햇는데
debug assertion failed!
라고 나오네요 텍스트 파일은 만들어서 폴더안에 잘넣구요..
문제가 뭘까요! 파일입출력 실행오류!질문 내용 :
#includestdio.h
#includestdlib.h
#includeconio.h
int main(void){
file *fp;
char str[]=and my name is kwon dai-hyun;
char ch;
int age=24, num;
fp=fopen(test.txt,w);
if(fp=null){
puts(file open error !);
exit(1);
}
fprintf(fp, %d is my age , age );
fputs(str,fp);
fclose(fp);
fp=fopen(test.txt,r);
if(fp==null){
puts(file open error);
exit(1);
}
fscanf(fp, %d %c, &num,&ch);
printf(%d %c,num,ch);
while((ch=fgetc(fp))!=null)putchar(ch);
fclose(fp);
getch();
return 0;
}
-
오나미
태그로 사용된 \test.txt\는 검색에 도움이 되지 않으므로 삭제합니다.
불필요한 태그를 반복하면 탈퇴될 수 있습니다. 참고하세요.