/* PROGRAM TO MERGE TWO FILES INTO ONE */
#include #include void main(int argc,char *argv[4]) { FILE *f1,*f2,*f3; char ch;
if(argc!=4) { printf("USAGE : MERGE "); exit(); }
if( ( f1 = fopen(argv[1],"r") ) == NULL ); { printf("\n%s & %s are merged into %s!",argv[1],argv[2],argv[3]); fclose(f1); exit(); }
if( ( f2=fopen(argv[2],"r") ) == NULL) { printf("\n%s is not found!",argv[2]); fclose(f2); exit(); }
f3=fopen(argv[3],"w");
while(!feof(f1)) { ch=fgetc(f1); fputc(ch,f3); } while(!feof(f2)) { ch=fgetc(f2); fputc(ch,f3); } printf("File merging completed!"); fclose(f1); fclose(f2); fclose(f3); }
|
| Author: Lenin 10 Jun 2008 | Member Level: Diamond Points : 2 |
hi giri are you a computer student , i know only small programs in C.But i know C is a SEA.Am i right ? I remember the days when i used to mugup the codings for Lab exams.still c fear is there. Also still C is in flying colours
|