Results 1 to 2 of 2

Thread: QIODevice::Unbuffered on Windows. But why not.....

  1. #1
    Join Date
    Jan 2016
    Posts
    1
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default QIODevice::Unbuffered on Windows. But why not.....

    Hi all.

    I was looking for an unbuffered write to disk using QSaveFile and noticed the QIODevice::Unbuffered ( http://doc.qt.io/qt-5/qiodevice.html#OpenModeFlag-enum ) mode, which seemed just like what I needed. Unfortunately the notes for that particular mode says
    and limitations in the native API prevent QFile from supporting Unbuffered on Windows.
    Knowing that Windows has both a FlushFileBuffers() function and FILE_FLAG_NO_BUFFERING and FILE_FLAG_WRITE_THROUGH flags ( https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx ) I an curious as to why QFile does not support QIODevice::Unbuffered as it seems to match pretty darn well with the flags mentioned.

    Can anybody shed light on that matter?

    Cheers,
    Morten

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QIODevice::Unbuffered on Windows. But why not.....

    There might be a bug report detailing this, or a comment in the commit log for the Windows implementation of the file engine.
    It could also be an outdated comment.

    The cross-platform code always passes Unbuffered to the native code: https://code.woboq.org/qt5/qtbase/sr...OpenModeFlagEE

    The Windows implementation doesn't seem to check for this flag though: https://code.woboq.org/qt5/qtbase/sr...OpenModeFlagEE

    Maybe CreateFile2() doesn't have the necessary capability?

    Cheers,
    _

Similar Threads

  1. Extending QIODevice, is it possible?
    By davidovv in forum Qt Programming
    Replies: 6
    Last Post: 6th January 2014, 10:58
  2. use QUdpSocket as a QIODevice
    By feverzsj in forum Qt Programming
    Replies: 0
    Last Post: 19th December 2012, 04:50
  3. QIODevice and QTextCodec?
    By whitefurrows in forum Qt Programming
    Replies: 5
    Last Post: 26th November 2010, 18:50
  4. QIODevice
    By sabeesh in forum Newbie
    Replies: 1
    Last Post: 26th September 2007, 10:01
  5. QIODEvice
    By mickey in forum Qt Programming
    Replies: 2
    Last Post: 5th July 2006, 19:00

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.