kg <kg*******@gmail.com> wrote:
how to read the disk block in linux using c .. and also i want to
display the information like number of sectors in the disk ..number of
free sector .. totaly i want to display the partion informaation
In linux, like most unices, the raw disk is available as a special file
in the /dev filesystem. You can use the standard C file I/O functions to
access these files:
#include <stdio.h>
int main(void)
{
FILE *f;
char block[512];
int r;
f = fopen("/dev/hda", "r");
if(f == NULL) exit(EXIT_FAILURE);
r = fread(block, 1, sizeof(block), f);
/* Do something with the data */
return 0;
}
For more information about those special device files and their
contents, you better ask the proper *.linux.* newsgroup.
--
:wq
^X^Cy^K^X^C^C^C^C