Hi
I want to raw read the hard disk sector on mac using xcode c++ project.I am using following code for that
#define _LARGEFILE64_SOURCE //FOR READING LARGE CAPACITY HARD disk
#define _FILE_OFFSET_BITS 64
#define _LARGEFILE_SOURCE
#include<stdio.h>
#include<stdlib.h>
FILE * pFile;
unsigned char * buffer[512];
pFile = fopen ( "/dev/disk1" , "rb" );
if (pFile==NULL) exit (1);
fseeko(pFile ,(off_t)1826*512, SEEK_SET);
// copy the file into the buffer.
fread (buffer,512,1,pFile);
/*** the whole file is loaded in the buffer. ***/
pFile = fopen ("myfile.doc" , "wb+");
fwrite (buffer , 512 ,1, pFile);
fclose (pFile);
But in some cases i found that readed sector have different values that actual values. Plz if there is any other function for reading and writing or other way then plz help me to sought out my problem.
I want to raw read the hard disk sector on mac using xcode c++ project.I am using following code for that
#define _LARGEFILE64_SOURCE //FOR READING LARGE CAPACITY HARD disk
#define _FILE_OFFSET_BITS 64
#define _LARGEFILE_SOURCE
#include<stdio.h>
#include<stdlib.h>
FILE * pFile;
unsigned char * buffer[512];
pFile = fopen ( "/dev/disk1" , "rb" );
if (pFile==NULL) exit (1);
fseeko(pFile ,(off_t)1826*512, SEEK_SET);
// copy the file into the buffer.
fread (buffer,512,1,pFile);
/*** the whole file is loaded in the buffer. ***/
pFile = fopen ("myfile.doc" , "wb+");
fwrite (buffer , 512 ,1, pFile);
fclose (pFile);
But in some cases i found that readed sector have different values that actual values. Plz if there is any other function for reading and writing or other way then plz help me to sought out my problem.