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 |
Why we write conio h in c?
What are the phases in s/w developed life cycle? wat is the diff b/w stack & queue...where do we use stack
Should I learn c before c++?
a) Identify the following declarations. Ex. int i (integer variable) float a[l0](array of 10 real nos) int (*f())() void *f int (*f()) [] void *f int f[] [] [] char *(*f) () int (*f[]) [] float(*f) [] [] float **f int ******f
What is structure in c definition?
Write a program to print the following series 2 5 11 17 23 31 41 47 59 ...
Should I learn data structures in c or python?
Do you know what is a programing language ?
How do you print only part of a string?
Tell me what is the purpose of 'register' keyword in c language?
What are register variables? What are the advantage of using register variables?
What is an object?