how to get the starting address of file stored in harddisk
through 'C'program.

Answers were Sorted based on User's Feedback



how to get the starting address of file stored in harddisk through 'C'program...

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

how to get the starting address of file stored in harddisk through 'C'program...

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

Post New Answer

More C Interview Questions

difference between the array and linked list general difference related to memory

2 Answers  


What is the right type to use for boolean values in c?

0 Answers  


will u give me old quesrion papers for aptitude for L & t info tech?

1 Answers   Hindustan, L&T,


Explain what are multibyte characters?

0 Answers  


How can I increase the allowable number of simultaneously open files?

1 Answers   ABC,


Explain what’s a signal? Explain what do I use signals for?

0 Answers  


write aprogram for There is a mobile keypad with numbers 0-9 and alphabets on it. take input of 7 keys and then form a word from the alphabets present on those keys.

1 Answers   iGate, Shashi, Source Bits, Subex,


Why & is used in scanf in c?

0 Answers  


can we print any string without using terminator?

2 Answers   Infosys, TCS,


Which is more efficient, a switch statement or an if else chain?

0 Answers  


What are the 32 keywords in c?

0 Answers  


How do you declare a variable that will hold string values?

0 Answers  


Categories