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
What is scanf_s in c?
What is the use of clrscr?
How can I call system when parameters (filenames, etc.) Of the executed command arent known until run time?
What is structure of c program?
Using functions, write a program that multiplies two arrays. Use the following functions: - Function ReadArray - Function MultiplyArrays - Function DisplayArrays
What are the salient features of c languages?
code for replace tabs with equivalent number of blanks
Why dont c comments nest?
What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?
What is the difference between int main and void main in c?
Why can't I perform arithmetic on a void* pointer?
What are the functions to open and close file in c language?
Why pointers are used?
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
why do some people write if(0 == x) instead of if(x == 0)?