how to get the starting address of file stored in harddisk
through 'C'program.
Answers were Sorted based on User's Feedback
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 |
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 |
Write a c program to print the sizes and ranges of different data types in c?
How can you avoid including a header more than once?
is it possible to change the default calling convention in c ?
main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); } what is the output?
What are the standard predefined macros?
int main() { int *p=new int; *p=10; del p; cout<<*p; *p= 60; cout<<*p; } what will be the output & why?
what information does the header files contain?
6 Answers BSNL, Cisco, GDA Technologies,
Without using main fn and semicolon,print remainder for a given number in C language
get any number as input except 1 and the output will be 1.without using operators,expressions,array,structure.don't print 1 in printf statement
What are directives in c?
How to find the digits truncation when assigning the interger variable to the character variables. like int i=500; char x = i : here we have truncation. how to find this. another ex: i =100; char x=i. here we do not have truncation.
Where we use clrscr in c?