프로그래밍

[C/C++] 파일 입출력 std::fstream 사용법

Mesia 2015. 6. 20. 14:45

#include<iostream>
#include<fstream>

using namespace std;

int main(){
  fstream f
(FILENAME, fstream::in );


  string s
;
  getline
( f, s, '\0'); //파일 전체를 한번에 읽는다

  cout
<< s << endl;
  f
.close();
}