combine two large existing files

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

Reply to
Gary Hu
Loading thread data ...

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

Reply to
Paul Keinanen

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

Reply to
Gary Hu

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

Reply to
Michael Schnell

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.