[Ffmpeg-devel] Re: [PATCH] qt-faststart > 4gb files compliant

Rich Felker dalias
Mon Mar 20 22:47:59 CET 2006

On Mon, Mar 20, 2006 at 04:09:01PM +0100, Steve Lhomme wrote:
> Rich Felker wrote:
> >On Mon, Mar 20, 2006 at 02:01:40PM +0100, Steve Lhomme wrote:
> >>Baptiste COUDURIER wrote:
> >>>Hi
> >>>
> >>>Steve Lhomme wrote:
> >>>>[...]
> >>>>
> >>>>
> >>>>But now MinGW build is broken (for qt-faststart)...
> >>>>
> >>>Heard of it, will define fseeko to fseek on win32, any chance win32 have
> >>>a 64 bit functions ? fseeko64, ftello64 ?
> >>According to MSDN, fseek takes a long for the offset. So it should be 
> >>enough.
> >
> >No, long is not enough. That's the whole reason fseeko/ftello were
> >added by posix.
> So you might use _lseeki64(). It uses a file descriptor so you need to 
> use _fileno() too.

seeking on the underlying file descriptor when using stdio WILL
CORRUPT FILES! this is because there may be unwritten buffered data,
or data that has already been read but still in buffers. in general
you can never mix stdio and file descriptor io. use either one or the
other but not both.


p.s. with particular implementations there may be workarounds but in
general the stdio FILE* interface is an _opaque_ interface and there
is no way to work around it. if windows does not provide 64bit FILE*
seeking primitives then you're stuck with 32bit limitations unless you
want to switch to fd io.

More information about the ffmpeg-devel mailing list