File Operations in Tamil


 fgets-in-c

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 fgets

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 :

  1. In this statement we create the character array with its variable name as “a”.
  2. Here in this statement we get the file input string using “fgets” function.
  3. Here in this printf statement we print the output content.

Sample Output - Programming Examples

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

View More Quick Examples


Related Searches to C fgets