c++文件小测试。。。

实现的功能是让输出终端(即显示器)输出编译器中的内容。。。。

#include #include #include using namespace std; struct SalaryInfo{ unsigned id; double salary; }; int main() { SalaryInfo employeel={600001,80000}; ofstream os("c:\\1.txt",ios_base::out|ios_base::binary); os.write(reinterpret_cast(& employeel),sizeof( employeel)); os.close(); ifstream is("D:\\编程文件\\main.cpp",ios_base::in|ios_base::binary); if(is){ char ch; while((ch=is.get())!=EOF) cout.put(ch); } is.close(); system("pause"); }

你可能感兴趣的:(c++文件小测试。。。)