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
Define C in your own Language.
can any one tel me wt is the question pattern for NIC exam
What 'lex' does?
What are the advantages of using new operator as compared to the function malloc ()?
What is the benefit of using #define to declare a constant?
What is the difference between struct and union in C?
application attempts to perform an operation?
Is c a great language, or what?
Explain about the constants which help in debugging?
Can you please explain the scope of static variables?
Why doesnt the call scanf work?
Why is void main used?
What does s c mean on snapchat?
What does *p++ do? What does it point to?
How can my program discover the complete pathname to the executable from which it was invoked?