Results 1 to 5 of 5

Thread: Problem reading a windows path from INI file value

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2011
    Location
    Bangalore
    Posts
    254
    Thanks
    92
    Thanked 16 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Problem reading a windows path from INI file value

    For a value in ini file, I have a windows path, which I need to read.

    Ths is the content of my ini file
    Qt Code:
    1. [Mozilla]
    2. Dir1=C:\Firefox\sample\remediation
    3. Dir2=C:\Firefox\properties\messages.ini
    4. Dir3=C:\Firefox\sample\download.zip
    5. Dir4=C:\Firefox\sample
    To copy to clipboard, switch view to plain text mode 

    Here from Dir4 I need to take the value. But it's taking as escape sequences & giving me output as C:Firefoxsample.

    This is how I'm reading from the file.
    Qt Code:
    1. QSettings dwldFolder(qApp->applicationDirPath() + "/sample.ini", QSettings::IniFormat);
    2. dwldFolder.beginGroup("Mozilla");
    3. QString path = dwldFolder.value("Dir4").toString();
    4. qDebug() << "Path" << path; // Here it is giving - C:Firefoxsample
    5. dwldFolder.endGroup();
    To copy to clipboard, switch view to plain text mode 

    How do I convert it to C:\\Firefox\\sample or C:/Firefox/sample?

    And in documentation it's mentioned as QSettings always treats backslash as a special character and provides no API for reading or writing such entries. Any work around?
    Last edited by rawfool; 31st July 2013 at 12:00.

Similar Threads

  1. Add platform dependent path into pro file problem
    By alizadeh91 in forum Qt Programming
    Replies: 5
    Last Post: 7th October 2012, 01:06
  2. Replies: 1
    Last Post: 22nd May 2012, 01:28
  3. QRegExp validate windows file path
    By niol1000 in forum Newbie
    Replies: 2
    Last Post: 30th January 2010, 15:06
  4. Problem to find file path
    By phillip_Qt in forum Qt Programming
    Replies: 14
    Last Post: 28th April 2008, 10:06
  5. Replies: 0
    Last Post: 14th December 2007, 01:33

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
  •  
Qt is a trademark of The Qt Company.