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
Explain how can I pad a string to a known length?
How are variables declared in c?
Explain how can I write functions that take a variable number of arguments?
console I/O functions means a) the I/O operations done on disk b) the I/O operations done in all parts c) the input given through keyboard is displayed VDU screen d) none of the above
What are the different types of control structures?
If a five digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits.For example if the number that is input is 12391 then the output should be displayed as 23402
What is queue in c?
How do I determine whether a character is numeric, alphabetic, and so on?
Why can’t we compare structures?
Write the Program to reverse a string using pointers.
Can you subtract pointers from each other? Why would you?
Can I use base-2 constants (something like 0b101010)? Is there a printf format for binary?
What are the disadvantages of external storage class?
Explain pointer. What are function pointers in C?
How do I get an accurate error status return from system on ms-dos?