0

I use Qt Creator and this code :

string execpath = "";
execpath += (QCoreApplication::applicationDirPath()).toStdString();
WinExec("ffmpeg -f dshow -t 32 -i audio=\"virtual-audio-capturer\" -y "+(execpath.c_str())+"\\sound.mp3", SW_HIDE); // Loopback captured in sound.mp3

generate this issue on line 3 :

invalid operands of types 'const char [60]' and 'const char*' to binary 'operator+'

How to solve it?

AmirH
  • 57
  • 11

1 Answers1

3

You'll want something like:

execpath += (QCoreApplication::applicationDirPath()).toStdString();
std::string cmd = "ffmpeg -f dshow -t 32 -i audio=\"virtual-audio-capturer\" -y "
WinExec((cmd +execpath +"\\sound.mp3").c_str(), SW_HIDE);
Mats Petersson
  • 126,704
  • 14
  • 140
  • 227
  • execpath is a variable that I use a lot in my code but I guess you are right – AmirH Feb 22 '14 at 17:23
  • This works : WinExec(string("ffmpeg -f dshow -t 32 -i audio=\"virtual-audio-capturer\" -y "+execpath+"\\sound.mp3").c_str(), SW_HIDE); // Loopback captured in sound.mp3 – AmirH Feb 22 '14 at 17:24