fgets in c
snippet in c

fgets c

user2923

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

fgets in c

user5685

// 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; 
} 

fgets function in c

user9121

char str[20]; //declare string of 20
fgets(str, 20, stdin); // read from stdin
puts(str); // print read content out to stdout