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


Please Help Members By Posting Answers For Below Questions

Explain the ternary tree?

786


Discuss the function of conditional operator, size of operator and comma operator with examples.

876


Describe the header file and its usage in c programming?

808


What functions are used for dynamic memory allocation in c language?

835


Explain what does a function declared as pascal do differently?

903


Explain the advantages of using macro in c language?

756


How to create struct variables?

792


What is the use of typedef in c?

774


Can we increase size of array in c?

705


What is a spanning Tree?

1221


What are the application of c?

833


What are extern variables in c?

728


What is d scanf?

777


What is pass by value in c?

767


When should the const modifier be used?

846