有一个奇怪的问题
sprintf(tmp, "\"%s\"", filename);
我希望输出是
"filename"
但相反我得到
\"filename\"
这里发生了什么?
==============================
extern "C" void __export __pascal MyFunc(LPTSTR m_avi, LPTSTR m_mpg)
{
int frameRate = 20;
char szAVI[MAX_PATH], szMPG[MAX_PATH];
#ifdef UNICODE
wcstombs(szAVI, m_avi, _tcslen(m_avi) + 1);
wcstombs(szMPG, m_mpg, _tcslen(m_mpg) + 1);
#else
strcpy(szAVI, m_avi);
strcpy(szMPG, m_mpg);
#endif
//Call to ffmpeg.exe
char cmdline[1000] = "ffmpeg ", tmp[50];
//Overwrite without asking
strcat(cmdline, "-y ");
//Input file
sprintf(tmp, "-i \"%s\" ", szAVI);
strcat(cmdline, tmp);
//Lock output at 20 frames per second
sprintf(tmp, "-r %i ", frameRate);
strcat(cmdline, tmp);
//Output file
sprintf(tmp, "\"%s\"", szMPG);
strcat(cmdline, tmp);
WinExec(cmdline, SW_HIDE);
}