다음을 통해 공유


ifstream

파일에서 직렬로 싱글바이트 문자 데이터를 읽는 데 사용할 스트림을 정의합니다. ifstream은 char에 대한 basic_ifstream 템플릿 클래스를 특수화하는 typedef입니다.

wchar_t 더블 와이드 문자를 읽도록 basic_ifstream을 특수화하는 typedef인 wifstream도 있습니다. 자세한 내용은 wifstream을 참조하십시오.

typedef basic_ifstream<char, char_traits<char> > ifstream;

설명

형식은 기본 문자 특성을 포함하는 char 형식의 요소용으로 특수화된 basic_ifstream 템플릿 클래스의 동의어입니다. 예제는 다음과 같습니다.

using namespace std;

ifstream infile("existingtextfile.txt");

if (!infile.bad())

{

// Dump the contents of the file to cout.

cout << infile.rdbuf();

infile.close();

}

요구 사항

헤더: <fstream>

네임스페이스: std

참고 항목

참조

basic_ifstream 클래스

iostream 프로그래밍

iostreams 규칙

기타 리소스

basic_ifstream 멤버

<fstream> 멤버