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 the use of in c?
What do you mean by recursion in c?
What is static memory allocation? Explain
What do you understand by normalization of pointers?
Is a pointer a kind of array?
What are the types of unary operators?
What does typeof return in c?
How can you increase the size of a statically allocated array?
What is the process to create increment and decrement stamen in c?
Is c still used?
What is #error and use of it?
Does * p ++ increment p or what it points to?
An instruction which is analysed and acted upon by the processor prior to the compiler going its work a) directive b) constructive c) constant d) absolute mode
Why do we use namespace feature?
What are formal parameters?