fgets in C
File Operations in Tamil

Learn C - C tutorial - Fgets in c - C examples - C programs
C - fgets() - Definition and Usage
- In C – Programming, the fgets function is used to get the input string.

C Syntax
char *fgets(char *str, int size, file* file);
Sample - C Code
#include <stdio.h>
#include <stdio.h>
void main()
{
char a[10];
clrscr();
printf("Enter Your Content : \n");
fgets(a,10,stdin);
printf("Wikitechy is a %s\n",a);
getch();
}
C Code - Explanation :

- In this statement we create the character array with its variable name as “a”.
- Here in this statement we get the file input string using “fgets” function.
- Here in this printf statement we print the output content.
Sample Output - Programming Examples

- Here in this output we get the input text “Technical Forum” using fgets function as shown here.
- So the final output string will be displayed using printf function as “Wikitechy is a Technical Forum”