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

write a c program to calculate sum of digits till it reduces to a single digit using recursion

0 Answers   IBM,


provide an example of the Group by clause, when would you use this clause

0 Answers  


2. Counting in Lojban, an artificial language developed over the last fourty years, is easier than in most languages The numbers from zero to nine are: 0 no 1 pa 2 re 3 ci 4 vo 5 mk 6 xa 7 ze 8 bi 9 so Larger numbers are created by gluing the digit togather. For Examle 123 is pareci Write a program that reads in a lojban string(representing a no less than or equal to 1,000,000) and output it in numbers.

3 Answers   Nagarro,


What is modifier & how many types of modifiers available in c?

0 Answers  


a linear linked list such that the link field of its last node points to the first node instead of containing NULL a) linked list b) circular linked list c) sequential linked list d) none

0 Answers  






a simple c program using 'for' loop to display the output 5 4 3 2 1

2 Answers   Google,


Who developed c language and when?

0 Answers  


What does 2n 4c mean?

0 Answers  


How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?

2 Answers   Aricent, Manipal University,


hi, which software companys will take,if d candidate's % is jst 55%?

0 Answers  


The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this

1 Answers  


Expand the following LKB BKL FFG

0 Answers  


Categories