C program to read data from file using fgets() function
3 years ago
C Programming
C program to read data from file using fgets() function
#include<stdio.h>
int main()
{
FILE *fp;
char str[100];
fp = fopen("file.txt", "r");
//Read string using fgets()
fgets(str, 8,fp);
printf("%s",str);
fclose(fp);
return 0;
}
Rajiv Shah
Jul 21, 2022