Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8647375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:03:14+00:00 2026-06-12T13:03:14+00:00

There are two QFile-pointer pointing to the same file, they belong different threads. One

  • 0

There are two QFile-pointer pointing to the same file, they belong different threads. One writes data to the file, the other reads. But I want to have only one operation going on, read or write.

if(!this->file->exists()) {
   qDebug()<<"The file is not exists";
}
if(this->file->isOpen()) {
   qDebug()<<"The file is open";
}

Let me put it another way: how to check whether the file in opened?

I test file.isOpen()? It doesn’t work. How can I do that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T13:03:15+00:00Added an answer on June 12, 2026 at 1:03 pm

    Sounds like to me you’re trying to use isOpen to see if another thread has the same file open. AFAIK isOpen just tells you if the current QFile instance has a file open, not other QFile instances.

    The only way I’m aware of being able to prevent different threads from reading and/or writing the same file is with file locking.

    Not too sure if Qt has a way of doing this without having to delve into the more OS dependent APIs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are two project in which I collaborate, they live in different servers, A
Why are there two classes for almost the same purpose System.IO.File and System.IO.FileInfo ?
I have read a document that they say: In java there two types of
There are two intents on the receiver side which are called from the same
There are two table s : one is the master and one the detail
There are two very useful functions in SLIME: slime-copy-or-inspect-presentation-at-mouse and slime-presentation-menu . But they
Why are there two different HTTPService classes in Flex? this and this And the
Suppose I define two classes in a CSS file with the same name, like
Hi i have notice there two date times facebook gives, one is a date
I have the following problem: There two separate vCenters (ESXi). They cannot see each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.