c++ - 使用 "App.exe"命令从 Matlab 调用 (cpp) "System"

标签 c++ matlab command-line cmd

我正在尝试从 matlab 调用一个“App.exe”文件(用 cpp 编写),该文件将视频名称(字符串)作为输入

我想使用执行操作系统命令并将结果返回给 Matlab 的函数“System”。

我在 Matlab 中写了以下内容:

 system ('App.exe <'  VideoName);

以及 Cpp 中的以下内容:

 // to get the name of the video (the input) from the command.
 std::string str;
 getline(cin, str);
 const char * name = str.c_str();

但是它不起作用。 所以我的问题是:我们如何通过输入从 matlab(甚至 cmd)调用“App.exe”。 我应该怎么做才能完成这项工作?

最佳答案

我不熟悉 matlab 语法,但您可能应该尝试将整个路径放入 App.exe。Matlab 的工作目录可能与 App.exe 所在的目录不同。或者,您可以将 App.exe 所在的目录添加到您的 PATH 环境变量中(并在执行此操作后重新启动 matlab 以确保它获得新值)。

关于c++ - 使用 "App.exe"命令从 Matlab 调用 (cpp) "System",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10400196/

相关文章:

java - 双击 .jar 文件以在命令行中启动它

linux - 如何在 Git Bash 上初始化 bashrc

linux - 更改键盘布局 boot2docker tinycore

c# - 如何以编程方式格式化未分配的空间?

派生类中的 C++ 函数指针

c# - 同时从单个 Matlab dll 调用两个函数

python-2.7 - 区分手写和机器打印的文本

c++ - SDL 与 WSL

c++ - 无法访问的 glXMakeCurrent 使 C++ 应用程序崩溃

matlab - "Simple"边缘-线-检测