Check out example codes for "fgets c". It will help you in understanding the concepts better.

Code Example 1

// C program to illustrate 
// fgets() 
#include <stdio.h> 
#define MAX 15 
int main() 
{ 
    char buf[MAX]; 
    fgets(buf, MAX, stdin); 
    printf("string is: %s\n", buf); 
  
    return 0; 
}

Code Example 2

<open file>
while(fgets(<char array>, <size of array>, <file pointer>) != null)

Learn ReactJs, React Native from akashmittal.com