how to get the starting address of file stored in harddisk
through 'C'program.
Answer Posted / amvel
U can use FILE pointer, to find the address of a file in ur
hard disk.
What u hav to do is, Just pass the directory of the file to
lib function fopen(), to which u wanted to know the
address, and assign the return value of the function to a
FILE pointer. Now the file pointer holds the address of the
file.
Lets, look at the below code for better clarity.
#include<stdio.h>
#include<conio.h>
void main()
{
FILE *fp ;
char ch ;
fp = fopen("C:\\Documents and
Settings\\Vadivelt\\file.txt", "w+");
/*Gives the starting adds of ur file in the hard disk*/
printf("%d \n", fp);
_getch();
}
Is This Answer Correct ? | 4 Yes | 2 No |
Post New Answer View All Answers
What is a protocol in c?
Differentiate Source Codes from Object Codes
Are comments included during the compilation stage and placed in the EXE file as well?
What does sizeof int return?
What happens if you free a pointer twice?
Why do we use int main instead of void main in c?
Explain what is the benefit of using enum to declare a constant?
When should structures be passed by values or by references?
Why c is called object oriented language?
What is the Purpose of 'extern' keyword in a function declaration?
What is the right type to use for boolean values in c? Is there a standard type? Should I use #defines or enums for the true and false values?
how many key words availabel in c a) 28 b) 31 c) 32
Why is c fast?
Why void is used in c?
What are the 4 types of functions?