Thursday, July 26, 2018

How to read STRING FROM text file by c program

How to read STRING FROM text file by c program


#include<stdio.h>
int main(){
char str[70];
FILE *p;
if((p=fopen("string.txt","r"))==NULL){
printf(" Unable t open file string.txt");
exit(1);
}
while(fgets(str,70,p)!=NULL)
puts(str);
fclose(p);
return 0;
}




go to link download

No comments:

Post a Comment