please tell me how to interect with hard disk data area with the help of c language
please tell me how to interect with hard disk data area with the help of c language
Your nearest C book should get you started. Other than that, consider reading the FAQ. Other than that, you'll have to make yourself clearer as to what it is you're trying to do, and where you're trying to do it.
Quzah.
Hope is the first step on the road to disappointment.
This is the API for opening and closing files, and accessing information in files.
fopen
fclose
fread
fwrite
fgets
fputs
Anything else is deep voodoo, and you really ought to know what the hell you are doing unless you really enjoy doing fdisk, format c: and reinstalling operating systems.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Here's a simple program to help you see how it works, consult manuals for more functions as listed by Salem. Thing to look out for is checking what the file function returns, much like how you check for malloc() etc.
Code:#include <stdio.h> #include <stdlib.h> const char* filename = "hello.txt"; int main(int argc, char **argv) { FILE* fp = fopen(filename,"w"); if (fp == NULL) { fprintf(stderr,"Could not open!"); exit (EXIT_FAILURE); } fputs("Inserting some text into disk\n",fp); fputs("And some more...\n",fp); if (fclose(fp) != 0) { fprintf(stderr,"Could not close!"); exit (EXIT_FAILURE); } return 0; }
> please tell me how to interect with hard disk data area with the help of c language
Oh, and the aforementioned voodoo requires a lot more information from you like your OS and compiler.
Not to mention things like root/admin priviledges.
And some other stuff....
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.