[C++]파일 입출력 간단예제 fstream (ifstream, ofstream)
C++ 에서 간단히 파일을 입력하고 출력하는 기능을 알아보겠습니다. 파일 입/출력을 하기위해 fstream 을 include, 문자열을 사용하기위해 string 을 include 해줍니다. #include #include #include 입력먼저 파일을 입력해보겠습니다. ofstream 을 통하여 txt파일이 생성되면서 내가 입력한 문자가 txt파일에 입력이됩니다. string out_line; ofstream out("test.txt"); for(int i=0;i>out_line; out