main()
{
FILE *fp1,*fp2;
char c;
fp1=fopen("sample.txt","r"); /* sample.txt is already existing file in the system */
if(fp1==NULL)
{
printf("\n file does not exist");
exit(1);
}
fp2=fopen("hello.txt","r"); /*hello.txt is a new file to be created */
if(fp2==NULL)
{
printf("\n file cannot be created");
exit(1);
}
while((c=getc(fp1))!=EOF) /* reading one character at a time from the file sample.txt*/
{
putc(c,fp2); /* writing one character at a time to a file hello.txt */
}
printf("\n successfully file copied");
}
OUTPUT:
successfully file copied
C program to concatenate one file to another file
C program to create a file and display file contents on to the screen , file handling in c, random access to a file, random handling in file, random file handling in c, random access to a file in C, getc(), putc(), Modi banned 500rs and 1000rs. new 500rs notes, new 1000rs note, new 2000 rupee note, new currency with chip enabled, 2000rs note with chip enabled.logic behind banning,hange, tax exemption on money, tax exemption on toll gate free, ATMS not wroking , firday new notes released , why 500 and 1000rs notes banned abdul kalam photo on 200rs n otes, tax on currency exc500 100rs notes clab sample programs fopen(), fclose(),getw(),putw(), c program to display file contents on to the screen. different typed of modes in files. differentiate between r and r+ mode, w and w+ mode , a and a+ mode.EOF, end of the file.
No comments:
Post a Comment