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);
}



main() { FILE *fs; char c[10]; fs = fopen(“source.txt”, ”r”); /* source.txt exists and ..

Answer / sahoo845

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

Post New Answer

More C Interview Questions

Where we use clrscr in c?

0 Answers  


how to execute with out main in cprogram

15 Answers   Infosys,


What is an identifier?

0 Answers  


what is foreign key in c language?

1 Answers   ADP,


What are different storage class specifiers in c?

0 Answers  






What's the difference between calloc() and malloc()?

4 Answers  


wat is output of the following int main() { const int j=2; int i; switch(i) { case 1:break; case j:break; default:break; } }

2 Answers  


What are structural members?

0 Answers  


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)==

4 Answers  


Can we replace the struct function in tree syntax with a union?

0 Answers   Huawei,


what is available in C language but not in C++?

10 Answers   CTS, TCS,


Categories