C Programming :: Input / Output
-
Which of the following statement is correct about the program?
#include
-
Which of the following statement is correct about the program?
#include
int main() { FILE *fp; char str[11], ch; int i=0; fp = fopen("INPUT.TXT", "r"); while((ch=getc(fp))!=EOF) { if(ch == '\n' || ch == ') { str[i]='\0'; strrev(str); printf("%s", str); i=0; } else str[i++]=ch; } fclose(fp); return 0; } -
Point out the correct statements about the program?
#include
int main() { FILE *fptr; char str[80]; fptr = fopen("f1.dat", "w"); if(fptr == NULL) printf("Cannot open file"); else { while(strlen(gets(str))>0) { fputs(str, fptr); fputs("\n", fptr); } fclose(fptr); } return 0; }