combine two large existing files

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hello,

I am looking forward a example source code by C to combine two existing
large files without moving data from one sector to the other for hight
performance base on embedded Linux platform. I think it is a quick way to
modify file systems table directly but it seems danger and difficult. Any
comments are welcome.

best regards,
Gary



Re: combine two large existing files


Quoted text here. Click to load it

What do you intend to do with the file after the two parts have been
combined ?

If you only do sequential reading on it, why not simply hack the read
routine so that after detecting end-of-file of the first original
file, silently close the first one, open the second original file and
continue reading from the beginning as if nothing had happened. From
the application point of view it would appear as you were reading the
concatenated file.

Paul


Re: combine two large existing files
Quoted text here. Click to load it

My application is an QuickTime format encoder (*.mov). In QuickTime format
file, one part is video data and the other part is audio data. When user
start to record something, I seperate recording raw data into audio data as
a file, video data as the other one. When user stop record, I concatenate
one to the end of the other as one file and add a hearder to it. That's what
I want.

Gary





Re: combine two large existing files
Quoted text here. Click to load it

I don't think that is easily possible.

If it would be possible it would include dismounting the file system,
work on the media level and remount the file system.

But even here I suppose that in most file systems the files are
allocated in blocks and you can't have half-filled blocks in the middle
of a file.

So the only obvious way is to create a new file system. Maybe this can
sit on a standard file system and off the requested feature as an add-on
by leaving the files as they are and provide a (new-style) directory
entry that combines the files on the fly.

-Michael

Site Timeline