상세한 설명 생략.

에러처리 필요.

텍스트 파일만 테스트 함
binary 파일은 테스트 안해보았음.


1
2
3
4
5
6
7
8
9
10
#include <fstream>

int main()
{
    std::ifstream in ("readme.txt"); // open original file
    std::ofstream out("newfile.txt"); // open target file
    out << in.rdbuf(); // read original file into target
    out.close(); // explicit close, unnecessary in this case
    in.close();// explicit close, unnecessary in this case
}


+ Recent posts