fgets function in c
snippet in c

fgets c

user8120

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

fgets in c

user3757

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

fseek function in c

user336

FILE* fp;
// if file is 50 bytes long:
fseek(fp, /* from the end */ 23, SEEK_END); // <- at 50 - 23 so 27
fseek(fp, /* from the start */ 23, SEEK_SET); // 23
fseek(fp, /* from the the current (see ftell) */ 10, SEEK_CUR); // 33

fgets function in c

user1347

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