[Qt-interest] QFile seeking from SEEK_SET ? ( fseek like function )
Francisco Gonzalez Morell
gzmorell at gmail.com
Wed Sep 15 13:33:00 CEST 2010
On Martes 14 Septiembre 2010 20:05:40 Constantin Makshin escribió:
> Please re-read the documentation — nothing says it sets position relative
> to the current one. What has caused you to make that assumption?
>
>From QFile Doc
/*
bool QFile::seek ( qint64 off ) [virtual]
Reimplemented from QIODevice::seek().
*/
>From QIODevice Doc
/*
bool QIODevice::seek ( qint64 pos ) [virtual]
For random-access devices, this function sets the current position to pos,
returning true on success, or false if an error occurred. For sequential
devices, the default behavior is to do nothing and return false.
When subclassing QIODevice, you must call QIODevice::seek() at the start of
your function to ensure integrity with QIODevice's built-in buffer. The base
implementation always returns true.
*/
The QFile Docs tells that it is reimplemented.
The function is declared: bool QFile::seek (qint64 off) [virtual]
The word "off" instead of "pos" seems to indicate that the parameter is an
offset not an absolute position.
At least in the platform I use it is an absolute position.
Perhaps doc should say:
bool QFile::seed (qint64 pos) [virtual]
Francisco
> On Tuesday 14 September 2010 07:01:39 Aaron Lewis wrote:
> > On 09/14/2010 10:42 AM, Malyushytsky, Alex wrote:
> > > It helps to check base class documentation: bool QIODevice::seek (
> > > qint64 pos )
> >
> > Thanks for quick reply ;-)
> >
> > QFile *fp = new QFile();
> >
> > Blabla ...
> >
> > fp->seek( 7 - fp->pos() );
> >
> >
> > Yep , it works for negative numbers , but was it supposed to be like
> > that ?
> >
> > Thanks.
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list