How to Create File in C Programming
Get Certified in C Programming and Take Your Skills to the Next Level
Program 1
//Program for create file in C Language
#include<stdio.h>
#include<conio.h>
void main()
{
FILE *fp=NULL;
char ch;
fp=fopen("e://cdata/employee.txt","w");
if(fp==NULL)
printf("File not created.........");
else
{
printf("\nEnter a String: ");
while(1)
{
ch=getche();
if(ch=='0') break;
fputc(ch,fp);
}
printf("\n File created........");
fclose(fp);
}
}
Your opinion matters
Please write your valuable feedback about DataFlair on Google

