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);
}
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 |
What is data types?
What is meant by preprocessor in c?
How to add two numbers with using function?
what is array?
What is an auto variable in c?
There seem to be a few missing operators ..
Is javascript based on c?
Explain about the constants which help in debugging?
What is wild pointer in c?
for questions 14,15,16,17 use the following alternatives:a.int b.char.c.string.d.float
Is this program statement valid? INT = 10.50;
print 1-50 with two loop & two print Statement