Reputation: 129
I'm trying to open a text file in notepad using Qt but it keeps giving me this message:
What I'm using is the following:
QProcess::startDetached("C:\\Windows\\system32\\notepad.exe", { ":/notes.txt" });
Upvotes: 2
Views: 186
Reputation: 2426
Qt compiles resources added to a resource file into a binary format. Notepad (or any external tool) does not have access to the individual files that are part of it. If you want to provide access to the file to an external program, you'll have to either distribute your txt file alongside your application or write it to a temporary file on the fly before trying to open it.
After doing either of the two, you can then open your file with an external tool by passing the full path to QProcess::startDetached
.
Upvotes: 3