Sektoren Lesen Problem

thetrue

Mitglied
hi,

Code:
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
      char buff[50];
      FILE * fp;
      fp = fopen("\\\\.\\C:", "rb");
      for(int i=0; i<512; i++)
      {
      fread(buff, 1, 1, fp);
      cout<<"0x";
      printf("%X", buff);
      cout<<" ";
      }

return 0;
}

das functioniert irrgend wie nicht :( bekomme nur 512 mal das 0x22FF20 ausgegeben, was natürlich nicht stimmen kann

wie kann ich sektoren lesen?
 
das lag an fread ;)

hier mal code:
Code:
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
  	int buff;
  	FILE * fp;
  	FILE * outp;
  	outp = fopen("out.bin", "wb");
  	fp = fopen("\\\\.\\C:", "rb");
  	for(int i=0; i<512; i++)
  	{
  	buff = getc(fp);
  	putc(buff, outp);
  	}

return 0;
}
 
Zurück