/* 我想过这样做,但是无效。 所以任何帮助将不胜感激。 */
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
int main()
{
string name = "Karma";
string greet = "How was your day?";
string sums = name + greet;
system("say %s", sums) // not working
// system("say sums") not working
return 0;
}
最佳答案
您可以使用:
system(("say" + sums).c_str())
代替:
system("say %s", sums)
关于c++ - 如何在系统 ("say string variable"中使用字符串变量)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46995328/