哪里出了问题了?是不是数值太大
#include<stdio.h>#include<process.h>
#include <math.h>
#include<stdint.h>
void ReadMBR(unsigned char *buf,int i, int n)
{
printf("00 01 02 03 04 05 06 07 - 08 09 0A 0B 0C 0D 0E 0F \n");
for(;i<=n;i++)
{
if(buf[i]/16%16==0)
printf("0%X ",buf[i]);
else
printf("%2X ",buf[i]);
if((i+1)%8==0&&(i+1))
{
printf("- ");
}
if((i+1)%16==0&&(i+1))
{
printf("\n");
}
}
}
void main()
{
unsigned char buf[512]={0};
unsigned char buf1[512]={0};
FILE *fp;
int i,j;
fp=fopen("\\\\.\\PhysicalDrive0","rb");//二进制只读方式打开磁盘0
fread(buf,1,512,fp);//读取512字节(1个扇区),并将值放到buf数组中
i=buf[470]+buf[471]*pow(2,8)+buf[472]*pow(2,16)+buf[473]*pow(2,24);//确定DBR所在扇区
for(j=0;j<i-1;j++)
{
fseek(fp,512,SEEK_CUR);
}//将文件的读取位置转移到DBR的位置
fread(buf1,1,512,fp);//读取DBR
ReadMBR(buf1,0,511);
fclose(fp);
}