For a value in ini file, I have a windows path, which I need to read.
Ths is the content of my ini file
[Mozilla]
Dir1=C:\Firefox\sample\remediation
Dir2=C:\Firefox\properties\messages.ini
Dir3=C:\Firefox\sample\download.zip
Dir4=C:\Firefox\sample
[Mozilla]
Dir1=C:\Firefox\sample\remediation
Dir2=C:\Firefox\properties\messages.ini
Dir3=C:\Firefox\sample\download.zip
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.
dwldFolder.beginGroup("Mozilla");
QString path
= dwldFolder.
value("Dir4").
toString();
qDebug() << "Path" << path; // Here it is giving - C:Firefoxsample
dwldFolder.endGroup();
QSettings dwldFolder(qApp->applicationDirPath() + "/sample.ini", QSettings::IniFormat);
dwldFolder.beginGroup("Mozilla");
QString path = dwldFolder.value("Dir4").toString();
qDebug() << "Path" << path; // Here it is giving - C:Firefoxsample
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?
Bookmarks