mano M wrote:
> Hi,
>  
> how can I  concatenate files into single file . I am looking for the best 
> performance. Each file has above 50 MB size . I need it in C (not c++)
>  
> Pl. advice th best way
>  
> Thanks,
> Mano

"Best performance" is going to depend on the platform, compiler, and 
hardware (i.e. CPU, RAM, hard drive, OS, and file system).  But, in 
general, the OS typically already has a method of doing what you want 
directly.

*NIX - cat
Windows - copy

To implement something equivalent (but not necessarily as fast) in 
C/C++, look at fopen(), fread(), fwrite(), fclose() (BTW, those are 
perfectly valid functions in C++).  You should read/write in chunk sizes 
of multiples of the file system "cluster"/"block size" - and the more 
you can read into RAM at once, the faster the application will 
potentially go.  Although, you probably shouldn't read in more than the 
onboard CPU cache can hold and definitely don't allocate so much RAM 
that you start swapping out to disk.  It helps to also allocate and load 
on RAM page boundaries (e.g. if your cluster size is 512 bytes and a 
page of RAM is 4K, you should allocate a whole page and read in 8 
clusters at a time).

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/

Reply via email to