Results 1 to 2 of 2

Thread: How to avoid conflict, when I read&write one xml from two process?

  1. #1
    Join Date
    Jul 2017
    Posts
    1
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Question How to avoid conflict, when I read&write one xml from two process?

    Hi guys,
    recently I'm working on a project which translates three vb6 programs to windows C++ and Linux C++ version with Qt5. In the vb6 programs. The configs were written in windows registry, which I want to change to use xml file.

    How can I read and write one xml file at same time in different process?

    thx

  2. #2
    Join Date
    Apr 2013
    Location
    Prague
    Posts
    258
    Thanks
    3
    Thanked 65 Times in 59 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to avoid conflict, when I read&write one xml from two process?

    If the file is read-only then you do not need anything special. Simply open the file twice and read. if you are about to write then you need serialization of both writes and reads. Only one thread can read or write the file at one time. Therefore, use mutex (in qt, it is the QMutex class).

Similar Threads

  1. QML Read & Write XML
    By Mathan in forum Newbie
    Replies: 1
    Last Post: 7th September 2016, 12:28
  2. Replies: 4
    Last Post: 30th March 2011, 07:55
  3. QProcess plink.exe - how to process->write
    By Phalanx in forum Newbie
    Replies: 1
    Last Post: 25th February 2011, 09:40
  4. Replies: 2
    Last Post: 2nd November 2010, 05:15
  5. Process Read/Write
    By QbelcorT in forum Newbie
    Replies: 0
    Last Post: 20th November 2008, 03:08

Tags for this Thread

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.