내가() 함수
#include<stdio.h>
#include<stdlib.h>
int main()
{
//freopen("file1","w",stdout);
char str[]="command line with file";
char s[]="extra string";
puts(str);
puts(s);
system("PAUSE");
return 0;
}
나는 그것이 나에게 보여줍니다 콘솔의 출력을 참조
command line with file
extra string
Press any key to continue . . .
과 내가 같은 출력을 다음 코드를 기대 한 코드에서 주석 처리 된 행을 제거하여 파일에 출력을 기록 할 때. 그러나 출력은 다음과 같습니다.
Press any key to continue . . .
command line with file
extra string
왜 파일과 콘솔 출력이 구별 되나요? 여기 시스템 ("PAUSE") 함수는 문자열 출력을 담당합니다 Press any key to continue . . .
얼마나 많은 버퍼링 유형이'stdout'입니까 ?? –
나는 그 질문을 이해하지 못한다. –
당신이 인용 한 라인 버퍼 및 블록 버퍼. 다른 버퍼링 유형이'stdout'과 함께 존재하는지 물어 보았습니다. 또 다른 것은, 만약 내가 주어진 코드에서 콘솔처럼 파일에서 출력하고 싶다면'system ("PAUSE")'앞의'fflush'인가? 어떤 버퍼를'fflush'를 사용해서 플러시해야합니까 ??? –