Qt Application with CLI Commands
-
Quite simple indeed. Can I hide the command prompt or software interface while this is taking place? I do not want the user to see that a 3rd party application is behind this...
-
I don't believe that a command prompt or anything should appear. It's all handled in the background. It doesn't actually open a command prompt window and type in the commands.
-
Those arguments seem a little tricky...How's the order they should be written? For example the command line command for 7z is "7za a -t7z files.7z text1.txt" to create files.7z with text1.txt inside.
@QApplication a(argc, argv);
QObject *parent; QString program = "C:\Software\7za920\7za.exe"; QStringList arguments; arguments << "7za a -t7z files.7z text1.txt"; QProcess *myProcess = new QProcess(parent); myProcess->start(program, arguments); zipfile w; w.show(); return a.exec();@
-
@
QString program = "C:\Software\7za920\7za.exe"; // This is the app
QStringList arguments;
arguments << "a" << "-t7z" << "files.7z" << "text1.txt"; // Don't need "7za" here, it's already covered up there.
@ -
Hmm...done but it doesn't work...but where do we specify where the .txt file is located? How does the program know where to get it from?
-
Well, I would assume that you would know where the file is that you're wanting to work with. Shouldn't you probably just use the full path to it? "/path/to/text1.txt"
-
Still...
@QObject *parent;
QString program = "/Software/7za920/7za.exe";
QStringList arguments;
arguments << "a" << "-t7z" << "/Users/croussou_dm4/Desktop/files.7z" << "/Users/croussou_dm4/Desktop/text1.txt";
QProcess *myProcess = new QProcess(parent);
myProcess->start(program, arguments);@By the way, thanks for your support...
-
I'd suggest reading through the docs for QProcess. There are various ways to find the return code of the finished process (was it ok?) or to read from stderr (were there any error messages), and that sort of thing.
In the long run, it will be much more beneficial than me or anyone else trying to guess what the problems may be.
By the way, you're welcome!
-
Again thank you very much.
I will look into that.
-
Be sure and let us know what you find out!