Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Define C in your own Language.

1086


can any one tel me wt is the question pattern for NIC exam

1990


What 'lex' does?

1188


What are the advantages of using new operator as compared to the function malloc ()?

1353


What is the benefit of using #define to declare a constant?

1100


What is the difference between struct and union in C?

1319


application attempts to perform an operation?

1980


Is c a great language, or what?

1123


Explain about the constants which help in debugging?

1380


Can you please explain the scope of static variables?

1063


Why doesnt the call scanf work?

1197


Why is void main used?

1098


What does s c mean on snapchat?

1116


What does *p++ do? What does it point to?

1065


How can my program discover the complete pathname to the executable from which it was invoked?

1079