main()
{
FILE *fs;
char c[10];
fs = fopen(“source.txt”, ”r”); /* source.txt exists and
contains “Vector Institute” */
fseek(fs,0,SEEK_END);
fseek(fs,-3L,SEEK_CUR);
fgets(c,5,fs);
puts(c);
}
it prints ute.
SEEK_END moves the pointer to end of the file.
SEEK_CUR moves the pointer 3 places back(-3L). Nw the pointer is at u.
gets() tries to fetch 5 characters from the present position of pointer but can fetch only 3 characters as it reaches end of file.
puts() prints the characters i.e. ute.
Is This Answer Correct ? | 15 Yes | 0 No |
what is use of loop?
What is the difference between the = symbol and == symbol?
Why are all header files not declared in every c program?
How do I declare an array of N pointers to functions returning pointers to functions returning pointers to characters?
how to make program without <> in library.
How can I sort a linked list?
what is the output of the program?? #include<stdio.h> main ( ) { int a=010,sum=0,tracker: for(tracker=0;tracker<=a;tracker++) sum+=tracker; printf(“ %d\n”,sum); } what is the difference between a=10 and a=010??
What is difference between main and void main?
Can you think of a logic behind the game minesweeper.
Do you know what is the purpose of 'extern' keyword in a function declaration?
Juxtapose the use of override with new. What is shadowing?
to find the closest pair