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 |
Where we use clrscr in c?
how to execute with out main in cprogram
What is an identifier?
what is foreign key in c language?
What are different storage class specifiers in c?
What's the difference between calloc() and malloc()?
wat is output of the following int main() { const int j=2; int i; switch(i) { case 1:break; case j:break; default:break; } }
What are structural members?
How to reverse a string using a recursive function, without swapping or using an extra memory?
31 Answers Cisco, Mind Tree, Motorola, Ophio, Sony, TCS, Wipro,
which one is highest Priority in c? a)=,b)+,c)++,d)==
Can we replace the struct function in tree syntax with a union?
what is available in C language but not in C++?
10 Answers CTS, TCS,