万能文档加密解密器
1.打开VS2010
2.新建win32控制应用程序
3.代码
1 // filestream.cpp : 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include <fstream> //文档流 6 #include <iostream> 7 using std::cout; 8 using std::cin; 9 using std::endl; 10 using std::fstream; 11 12 int _tmain(int argc, _TCHAR* argv[]) 13 { 14 15 fstream srcFile; 16 // printf("PATH:%s\n",argv[1]); 17 // 输入/读 字节流 18 srcFile.open(argv[1],std::ios::in | std::ios::binary); 19 20 //2得到源文件的大小 21 //偏移量 文件大小 文件中末一个字节的数据距离某个位置的字节数 22 srcFile.seekg(0,std::ios::end); 23 std::streamoff size =srcFile.tellg(); 24 25 //要求用户输入目的文件名 26 char buff[256]={0}; 27 cout<<"请输入一个文件名:"<<endl; 28 cin>>buff; 29 //创建目的文件 30 fstream dstFile; 31 dstFile.open(buff,std::ios::out | std::ios::binary); 32 srcFile.seekg(0,std::ios::beg); 33 //3 读取源文件内容并写入 34 for(std::streamoff i=0; i<size;i++) 35 { 36 char data=srcFile.get()^0x88; 37 dstFile.put(data); 38 } 39 //关闭保存 40 dstFile.close(); 41 srcFile.close(); 42 while(1) return 0; 43 }
一个二次元的生物

浙公网安备 33010602011771号