Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Memory mapped QFile usage questions
Forum Updated to NodeBB v4.3 + New Features

Memory mapped QFile usage questions

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Violet Giraffe
    wrote on last edited by Violet Giraffe
    #1

    I have a pretty large file (hundreds megabytes). I have a list of thousands (possibly even hundreds thousand) locations in this file where I need to patch 4 bytes. Specific algorithm:

    • seek to a position;
    • overwrite 4 bytes;
    • run and external tool on this file;
    • revert these 4 bytes to the original value and proceed to the next location.

    Questions:

    1. Is it faster to map the whole file once, or map / unmap each location?
    2. Do I need to take special actions for the change to be actually written on disk? Will flush suffice, or do I have to unmap?
    1 Reply Last reply
    0
    • V Offline
      V Offline
      Violet Giraffe
      wrote on last edited by Violet Giraffe
      #2

      Turns out speed is not a concern, I started by trying map -> unmap -> flush - it's fast,
      I've also noticed that I don't need to call unamp and flush in order for the changes to be visible to other software. Is that just a coincidence, or is it guaranteed to work (this is a Windows only program)?

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved