Test/C
18.1 파일개방
kiostory
2017. 8. 11. 11:28
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
FILE *fp;
fp=fopen("a.txt", "r");
if(fp==NULL)
{
printf("파일이 없음");
system("pause\n");
exit(1);
}
printf("파일을 열었음");
system("pause");
return 0;
}
-------------------
프로그램 위치에 파일이 있어야 함(a.txt)