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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is getch () for?

670


Apart from dennis ritchie who the other person who contributed in design of c language.

801


A c program to display count values from 0 to 100 and flash each digit for a secong.reset the counter after it reaches 100.use for loop,. pls guys hepl me.. :(

1727


What is the difference between constant pointer and constant variable?

742


Explain what standard functions are available to manipulate strings?

608






What are preprocessor directives?

666


What is wild pointer in c?

601


Explain the bubble sort algorithm.

636


In a header file whether functions are declared or defined?

627


Explain the difference between exit() and _exit() function?

630


what are bit fields in c?

599


What is #include stdio h?

675


Write a program to print ASCII code for a given digit.

679


Q.1 write aprogram to stack using linklist o insert 40 items? Q.2 write a program to implement circular queue with help of linklist?

1594


What is the difference between far and near ?

676