[英]How can I launch a C application from terminal, and pass in paramaters to int main(int argc, char *argv[])?
I'm new to development on Mac - I'm coding in xcode and I can't figure out how to launch my application with paramaters. 我是Mac上开发的新手-我正在用xcode进行编码,我不知道如何使用参数启动我的应用程序。 I can navigate to the application directory and do something along the lines of:
我可以导航到应用程序目录并执行以下操作:
open application
But I can't do: 但是我不能:
open application param1 param2
What am I missing? 我想念什么?
Use the --args
flag, available in OS X 10.6.2 or later: 使用OS X 10.6.2或更高版本中提供的
--args
标志:
open application --args param1 param2
See How can I run an application with command line arguments in Mac OS for more information. 有关更多信息,请参见如何在Mac OS中使用命令行参数运行应用程序 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.