刚写的16进制查看工具
网上下了个16禁止查看,需要注册.懒得找破解版了,就想自己写个.
虽然自己写的功能只能查看,但是用起来也美滋滋的啊.
有什么格式或者逻辑上的错误没?
#include<iostream>#include<fstream>using namespace std;#define REMOVE 255#define ROW 16 void main() { system("title 十六进制查看工具"); system("color 70"); char p[255]={0}; char s; int i,j,k; while(1) { cout<<"请输入要打开的文件的路径"<<endl; cout<<"提示:可拖动文件到此输入框,路径以及文件名不要包含空格!!!"<<endl; cin>>p; noskipws;//这个估计可以去掉,毕竟不是字符输出. //fstream in("d:\\1",ios::in|ios::binary);//测试用代码 fstream in(p,ios::in|ios::binary); if(!in)cout<<"无法打开文件,请确认文件权限或者路径正确"<<endl; else { i=0; j=0; k=1; while(in.peek()!=EOF) { in.read(&s,1); printf("%02x ",s&REMOVE); i++; if(i>=ROW) { cout<<endl; i=0; j++; if(j>=ROW) { j=0; k++; cout<<"按任意键显示第"<<k<<"页..."<<endl; system("pause>nul"); } } } i=j=0; k=1; cout<<"\n此文件已结束!~"<<endl; } in.close(); } cout<<endl; system("pause");}