Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<conio.h>
- void main()
- {
- FILE *fp1, *fp2;
- char FileName[20], FileName2[20], str[500];
- clrscr();
- printf("\n Enter First File Name : ");
- gets(FileName);
- fflush(stdin);
- printf("\n Enter Second File Name : ");
- fflush(stdin);
- gets(FileName2);
- if((fp1=fopen(FileName,"r"))==0)
- {
- //First Creat Text File
- printf("\n Error First File");
- exit(1);
- }
- if((fp2=fopen(FileName2,"w"))==0)
- {
- //Create A New File
- printf("\n Error Second File");
- exit(1);
- }
- while((fgets(str,sizeof(str),fp1))!=NULL)
- fputs(str,fp2);
- printf("\n Success");
- fclose(fp1);
- fclose(fp2);
- getch();
- }
Add Comment
Please, Sign In to add comment