Unsolved i can't write in programfiles(x86)
-
Hello guys, i made a program to write in text file , when my text file is out of program files(x86) , i can edit it but when my text file is in program files(x86) i can't edit it , someone can help me why i can't write when the text file is in program files ? thanks
P.S: i m on windows 10 -
@Zunneh said in i can't write in programfiles(x86):
someone can help me why i can't write when the text file is in program files ?
Very simple: Windows forbids it.
Solution: Forget it - it's tons of worms if you try. We had old programs that did such things and we needed to install them outside program files on Windows 10 because it was simply impossible to do.
The better solution, however, is to store the data in the users directory:
C:\Users\xxx\
Regards
-
@aha_1980 Thank you for the quick reply , do you have an idea why Windows forbids it ?
-
@Zunneh you should look into QStandardPaths to get cross platform locations to write read and store data
https://doc.qt.io/qt-5/qstandardpaths.htmlFor why windows does not allow it, security reasons I would assume. Prevents mallware from messing with with importand programs.
To be honest, Windows is a good bit behind on that compared to other os, on Mac for example each program is its own seperated sandbox. Very hard to break out of that 😉