how to get the starting address of file stored in harddisk
through 'C'program.
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / venu
FILE *fp ; is a virtual address in library.
You need meta data to find the location on hard disk.
| Is This Answer Correct ? | 1 Yes | 2 No |
write a program in reverse the string without using pointer,array,global variable declaration,lib fun only using a function?
Can you tell me how to check whether a linked list is circular?
What are the modifiers available in c programming language?
what is the difference between static variable and register variable?
Explain what is wrong with this program statement? Void = 10;
How can I implement sets or arrays of bits?
What is the purpose of ftell?
What is the difference between c &c++?
What is Dynamic memory allocation in C? Name the dynamic allocation functions.
What is int main () in c?
what is recursion in C
Differentiate between a for loop and a while loop? What are it uses?