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

  • SEARCH
  • Home
  • 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 847777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:50:27+00:00 2026-05-15T06:50:27+00:00

I am a Qt beginner and just got stuck with the problem. I am

  • 0

I am a Qt beginner and just got stuck with the problem. I am looking for a file SomePath/NewDirectoryA/NewFile.kml (NewFile.kml will be the only file in NewDirectoryA, having this directory just to maintain semantics in the project).

If SomePath/NewDirectoryA/NewFile.kml exists then I will use it in my code and if it doesn’t exist then I have to create it. If this File doesn’t exist then this directory also doesn’t exist in SomePath. So If only I have to create a file I can use QFile and open it in ReadWrite or WriteOnly mode.

But the problem is I have to create the file with the directory itself.
I tried with QFile with file name SomePath/NewDirectoryA/NewFile.kml but it didn’t worked.

Please suggest me a way in which I can create a new file (NewFile.kml) in a new directory (NewDirectorA) at a given location (SomePath).

  • 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-05-15T06:50:28+00:00Added an answer on May 15, 2026 at 6:50 am

    bool QFile::open ( OpenMode mode ) [virtual]

    […]

    Note: In WriteOnly or ReadWrite mode,
    if the relevant file does not already
    exist, this function will try to
    create a new file before opening it.

    Qt’s caveat for file creation

    Platform Specific Issues

    File permissions are handled differently on Unix-like systems and
    Windows. In a non writable directory on Unix-like systems, files
    cannot be created. This is not always the case on Windows, where, for
    instance, the ‘My Documents’ directory usually is not writable, but it
    is still possible to create files in it.

    Directories are created with

    bool
    QDir::mkdir
    ( const QString & dirName ) const

    Creates a sub-directory called
    dirName.

    and

    bool QDir::mkpath
    ( const QString & dirPath ) const

    Creates the directory path dirPath.

    The function will create all parent
    directories necessary to create the
    directory.

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

Sidebar

Related Questions

I just got help in how to compile this script a few mintues ago
A beginner question, bear with me: I'm just wondering under what circumstances one should
I just got the add-on for firefox and it's awesome so far! But all
Recently I just got assigned a project to develop a web application/site that uses
I got this code from this site: http://www.php-mysql-tutorial.com/wikis/mysql-tutorials/using-php-to-backup-mysql-databases.aspx But I'm just a beginner so
Could someone please help me in here, I'm just a beginner who want to
I am total beginner with Solr and have a problem with unwanted characters getting
I'm just a beginner in SQL Server database development and was wondering which authentication
I am just a beginner in i-phone development and right now i am developing
I am writing a test code (I'm just a beginner) where I need to

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.