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 |
enum colors {BLACK,BLUE,GREEN} main() { printf("%d..%d..%d",BLACK,BLUE,GREEN); return(1); }
Array is an lvalue or not?
Which is better malloc or calloc?
Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.
program for comparing 2 strings without strcmp()
Lists the benefits of c programming language?
What is %s and %d in c?
Develop a flow chart and write a c program to find the roots of a quadratic equation ax2+bx+c=0 using switch and break statement.
#include<stdio.h> #include<conio.h> void main() { float a; clrscr(); a=0.5; if(a==0.5) printf("yes"); else printf("no"); getch(); }
pascal triangle program
what is the advantage of using SEMAPHORES to ORDINARY VARIABLES???
What is sorting in c plus plus?