#include<stdio.h>
#include<string.h>
int main()
{
char word[75], string[75], what[75];
int count=0;
FILE *inputfile;
count=0;
gets(word);
puts(word);
inputfile = freopen("input.txt", "r", stdin);
while(count<5)
{
gets(string);
puts(string);
count++;
}
fclose(inputfile);
gets(word);
puts(word);
return 0;
}
fopen해서 파일에 있는 거 쓰고 끝나면 fclose를 합니다.
그런데 fclose 하고 gets를 무시해버리는데 cmd에서 키보드로 받으려면 어떻게 해아하나요?
fgets로 바꾼다
freopen("CONIN$", "r", stdin);
로 해결했네요. 답변도 고맙습니다.