c++ - 为 Windows cmd 添加 argc

标签 c++ linux windows argc

使用 Linux,运行将 .txt 文件作为 argc 的 C++ 程序时。即

int main(int argc, char *argv[])

我可以简单地编译它,然后输入 ./a.out file.txt

使用 Windows 时,编译后,如何运行它,包括 file.txt 作为 argc?

最佳答案

您可以按照同样的方式进行操作,只是可执行文件的名称发生变化,例如program_name.exe file.txt

关于c++ - 为 Windows cmd 添加 argc,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29552864/

相关文章:

c++ - 在 C++ 中对 double 值使用 %

python - 文件锁定似乎不起作用(flock/lockf)

linux - cron 作业中的 ssh 代理转发

windows - 截取使用 createdesktop api 创建的桌面的屏幕截图

windows - 如何从 Windows 批处理文件测试 %PATH% 中是否存在可执行文件?

C++析构函数删除共享内存

c++ - 在 C++ Builder 6 中拖放图像

c++ - C/C++ 中的非 GPL 开源潜在狄利克雷分配实现/库

python - 如何让 Python 2.7 处理包含 "&& exit"的 shell 脚本?

python - 多处理池生成初始化非常慢,16 个进程需要 100 秒