ifstream f("D:\\file.txt",ios_base::binary);

       string str;

       char arr;

       while(f)

       {

              f.get(arr);

              str+=arr;       

       }

       cout<<str;

 

 

 

       ofstream f("D:\\file.txt");

       char ch;

       string str;

       while(cin.get(ch))

       {

              str+=ch;

       }

       f<<str;

 

//处理中文路径方法

1.路径前面加上加 L"路径"

2.打开文件前加上 setlocale(LC_ALL,"Chinese-simplified");

3. #include <tchar.h> _T("路径")