Is there any sideeffects of using system command
I want to control Media Player Daemon(mpd) with QT. To change songs I am using mpc which is commandline client for mpd. So my question is If I run mpc commands through system() command in Qt in another QProcess Is there any disadvantages of doing this.
new_command.startDetached("mpc play 1");
system("mpc play 1");
using mpd dev library to run functions directly from application as done in quimp application which is built in qt5.
Please give me your expert view which approach is best.Using whole API is very difficult for me now because I am newbie in C++ and qt.
I read in several places that using system is not recommended.
So I would avoid approach 2, but I don't know what is best between approach 1 and 3.
QProcess::startDetached("mpc play 1");
systemis very specific platformwise, that's why you're advised not to use it, otherwise you might need to handle OS-specifics.
Using the library directly (if possible) would be my choice. But you could certainly go with controlling an external process as well. The drawback of approach 1 is that you still have to ensure (broadly speaking) that the mpc program you're using exists on the user machine (it's true for approach 3 as well, because you depend on an external library that must be installed for your program to work). Either way is viable, though, so it depends on your preference.
thanks for your valuable replies.........