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

What is scanf_s in c?

621


What is the use of clrscr?

583


How can I call system when parameters (filenames, etc.) Of the executed command arent known until run time?

579


What is structure of c program?

592


Using functions, write a program that multiplies two arrays. Use the following functions: - Function ReadArray - Function MultiplyArrays - Function DisplayArrays

1880






What are the salient features of c languages?

616


code for replace tabs with equivalent number of blanks

1627


Why dont c comments nest?

608


What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?

893


What is the difference between int main and void main in c?

581


Why can't I perform arithmetic on a void* pointer?

626


What are the functions to open and close file in c language?

719


Why pointers are used?

626


The number of measuring units from an arbitarary starting point in a record,area,or control block to some other point a) recording pointer b) offset c) branching d) none

700


why do some people write if(0 == x) instead of if(x == 0)?

641