fputs()

#include<stdio.h>
int main()
{
    FILE *anik;

    anik = fopen("Das.txt", "a");

    char ch[50];

    if(anik == NULL)
    {
        printf("File Does Not Exist\n");
    }
    else
    {
        printf("File Is Open\n");
        printf("Enter Your Name : ");
        gets(ch);
        fputs(ch, anik);
        fputs("\n", anik);
        printf("File is written successfully\n");
        fclose(anik);
    }

    return 0;
}

Comments