1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

problem in merging the files

Discussion in 'C' started by san.crazy, Jul 7, 2008.

  1. san.crazy

    san.crazy New Member

    Joined:
    Jul 7, 2008
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    hi friends,

    I've coded a file merging program in C. though, the program seems to work far upto as how it supposed to but there is a problem.
    when i tried to merge few media files to make it a whole in one then i got its size desirable equal to the sum of all ones though but I didn't get it played anyway.

    Code:
    #include<stdio.h>
    #include<string.h>
    
    char buffer[BUFSIZ];
    main()
     {
          FILE *fsource,*fdest; char dirpath[30],sourcepath[40],destpath[40];
          int files=0,count;
          clrscr();
        // input directory
    
          printf("enter the full path of directory the content of which is to reconcile\n");
          gets(dirpath);
    
          printf("\nenter the number of files stored in this directory");
          scanf("\n%d",&files);
          strcpy(destpath,dirpath);
          strncat(destpath,"movie.flv",9);
    
          fdest=fopen(destpath,"wb");
          setvbuf(fdest,buffer,_IOFBF,BUFSIZ);
          fseek(fdest,0L,1);
          
    
          for(count=1;count<=files;count++)
    	{
    	  sprintf(sourcepath,"%s%d%s",dirpath,count,".flv");
    
    	  fsource=fopen(sourcepath,"rb");
    	  fseek(fsource,0L,1);
    	  setvbuf(fsource,buffer,_IOFBF,BUFSIZ);
    	  printf("\npart %d is being processed",count);
    
    	  while(fread(buffer,BUFSIZ,1,fsource))
    	    { 
                  
    	       fseek(fsource,BUFSIZ,1);
    	       fwrite(buffer,BUFSIZ,1,fdest) ;
    	       
    	       fseek(fdest,BUFSIZ,1);
    	    }
    	   printf("\npart %d is processed",count);
    	}
    
    
     }
    
    
    please someone nail out the problem
     
  2. san.crazy

    san.crazy New Member

    Joined:
    Jul 7, 2008
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    please someone check this out
     

Share This Page