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
Explain the ternary tree?
Discuss the function of conditional operator, size of operator and comma operator with examples.
Describe the header file and its usage in c programming?
What functions are used for dynamic memory allocation in c language?
Explain what does a function declared as pascal do differently?
Explain the advantages of using macro in c language?
How to create struct variables?
What is the use of typedef in c?
Can we increase size of array in c?
What is a spanning Tree?
What are the application of c?
What are extern variables in c?
What is d scanf?
What is pass by value in c?
When should the const modifier be used?