© 2014 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu
Quick Links
Easy Studies

CPP Program To Split and Join File
include #include #include #include #include #include struct s { char c; } data; int main() { char name[40],filename[40],ans; long double size=0,i=0,j,parts,loop,mod=0,mod1=0,option,counter=0; unsigned int handel,st=0; long int status=0,whrex,whrey; clrscr(); FILE *fp,*fp1; cout<<"\nWelcome To The File Spliter Programe"; cout<<"\n1. Split A File\n2. Join A File\n\nEnter Your Option "; cin>>option; if(option==1) { cout<<"\nEnter The Path Of The File Which Is To Be Splited"; gets(name); fp=fopen(name,"rb"); if(fp==NULL) { cout<<"\nCannot Open The Source File ------> Press Any Key To Exit......."; getch(); exit(1); } cout<<"Please Wait ---------------> WHILE FILE BEING ANALYSED........."; while(fread(&data,sizeof(data),1,fp)>0) { size++; } handel=open(name,O_CREAT); cout<<"The Size Of The File Is "<>parts; loop=size/parts; for(i=1;i<=parts;i++) { cout<<"Enter The "< Press Any Key ToExit......."; getch(); exit(1); } cout<<"Please Wait ......................"; whrex=wherex(); whrey=wherey(); for(j=1;j<=loop;j++) { fread(&data,sizeof(data),1,fp); mod1++; counter++; if(counter==status) { st++; gotoxy(50,15);cout<<"completion status.... "< Press Any Key ToExit......."; getch(); exit(1); } do { i++; cout<<"Enter The Name Of The "< Press Any Key ToExit......."; getch(); exit(1); } cout<<"Please Wait ......................"; while(fread(&data,sizeof(data),1,fp1)>0) { fwrite(&data,sizeof(data),1,fp); } fclose(fp1); cout<<"Do You Want To Join Another File (y/n)"; cin>>ans; }while(ans=='y'); fclose(fp); handel=open(name,O_CREAT); cout<<"The Size Of The File Is "<

Sample Output :

Welcome To The File Spliter Programe
1. Split A File
2. Join A File

Enter Your Option    1

Enter The Path Of The File Which Is To Be Splitedex.c
Please Wait ---------------> WHILE FILE BEING ANALYSED.........The Size Of The File Is 66 BYTES Enter The Parts In Which File Is To Be Splited

 
SLogix Student Projects
bottom