Hi!

L. Weiss wrote:

> BTW: Does it matter how much i strip? 4 or 8 bytes?

4 bytes should be enough - unless the PE marker appears twice.

> Whats the easiest way for 
> stripping? I used 'dd bs=1 count=<filesize - 4> if=... of=...' , but with a 
> blocksize of one byte it takes very long to copy the whole part...

If you have GNU tools:

        head --bytes=-4 < infile > outfile

Note the "-" in "-4".

In case you're a C programmer, you could also write a tiny tool that
uses (f)truncate(3) to chop off the end in almost no time (i.e. without
copying). Maybe it's a good idea to check whether the file really ends
with 00 00 01 b9 before chewing on its tail. E.g. like this:

        /*** BEWARE! ***/
        /*** Incomplete pseudo code without any error checking! ***/
        /*** Also remember to use -D_FILE_OFFSET_BITS=64 ***/

        uint32_t buf;
        off_t pos;
        int fd;

        fd = open(filename, O_RDWR);
        pos = lseek(fd, (off_t)-4, SEEK_END);
        if (read(fd, &buf, 4) == 4 && buf == htonl(0x1b9)) {
                ftruncate(fd, pos);
        }
        close(fd);

-- 
Michael "Tired" Riepe <[EMAIL PROTECTED]>
X-Tired: Each morning I get up I die a little

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
DVBCUT-devel mailing list
DVBCUT-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dvbcut-devel

Reply via email to