Quantcast
Channel: Writing to a local file in Qt6 Windows - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Writing to a local file in Qt6 Windows

$
0
0

I have a Qt6 app (Windows only) that store settings data as some .json files.Like

app/  app.exe  settings/    a.json    b.json

When I read the file, everything is ok.But when I'm opening an app not as admin and trying to update .json via write, nothing happens.

QFile file(QCoreApplication::applicationDirPath() +"/settings/a.json");if (file.open(QIODeviceBase::WriteOnly) == false) {    return; // <- here is the fail}QJsonArray json;for (const auto& config: _configs) {    json.push_back(ToJson(config));}file.write(QJsonDocument{json}.toJson());

How it can be solved without requiring an admin rights?Maybe Qt can offer some other mechanizm...?


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images