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 |
How do you initialize function pointers? Give an example?
What is an operator?
how to convert an char array to decimal array
What are the ways to a null pointer can use in c programming language?
Is c is a middle level language?
What are the types of data files?
a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor
Explain what is the benefit of using an enum rather than a #define constant?
What is a far pointer in c?
Toggle nth bit in a given integer - num
Are the variables argc and argv are local to main?
When should the volatile modifier be used?