|Jan 21, 2005, 09:14 AM||#1|
raw reading hard disk on mac
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
FILE * pFile;
unsigned char * buffer;
pFile = fopen ( "/dev/disk1" , "rb" );
if (pFile==NULL) exit (1);
fseeko(pFile ,(off_t)1826*512, SEEK_SET);
// copy the file into the buffer.
/*** the whole file is loaded in the buffer. ***/
pFile = fopen ("myfile.doc" , "wb+");
fwrite (buffer , 512 ,1, 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.
|Jan 28, 2005, 08:39 PM||#2|
I'm in a rush as I write this, but you might want to look into the xnu system call meta_bread() to read each block into a buf, set a semaphore, modify it, unlock it, then sync it back to disk. When I get more time I'll post some details.
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|Mac Book Pro New Hard disk||vinnied||iOS 5 and earlier||0||Oct 18, 2013 06:33 AM|
|Best hard disk enclosure for Mac Pro cylinder||peabo||Mac Pro||8||Sep 30, 2013 03:29 PM|
|Reading a Windows formatted disk||oriharel||OS X 10.8 Mountain Lion||2||Sep 11, 2013 10:00 AM|
|Cloning the MAC's Hard Disk||N.A.Malik||Mac OS X 10.7 Lion||4||Oct 23, 2012 11:34 AM|
|Mac to Mac content transfer using Hard disk||gvk5904||MacBook Pro||1||Jul 14, 2012 04:50 PM|
All times are GMT -5. The time now is 04:07 AM.