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

what is meant by flushll() in c programming?

1 Answers  


a sequence of bytes with one to one corrspondence to those in the external device a) sequential addressing b) address c) byte code d) none

0 Answers  


What is pass by value in c?

0 Answers  


how many times does the loop iterated ? for (i=0;i=10;i+=2) printf("Hi\n");

9 Answers   TCS,


Linked list is a Linear or non linear explain if linear how it working as a non linear data structures

0 Answers  






What's a "sequence point"?

3 Answers  


How can you allocate arrays or structures bigger than 64K?

0 Answers  


How can I prevent another program from modifying part of a file that I am modifying?

0 Answers  


What is the difference between array_name and &array_name?

0 Answers  


will u please send me the placement papers to my mail???????????????????

0 Answers  


How the C program can be compiled?

11 Answers   HP,


Between macros and functions,which is better to use and why?

0 Answers  


Categories