1

I have a program that works off command line input (argc and argv) but I don't know how to do that as I'm using XCode. Is there any way for me to get the command line input as user input in the program (e.g. cin the command line input through the program instead) and somehow convert that to argc and argv so I can run the main function which requires argc and argv?

4

2 回答 2

0

'xargs' 命令通常用于将数据流转换为 argv 类型的参数。我不知道在 XCode 中有一种实用的方法来配置它。

于 2013-09-06T19:42:41.007 回答
0

如果您想从文件中获取输入,您可以使用此解决方案:

在 Xcode 4 中重定向 I/O

请注意,通过转到 Product -> Scheme -> Edit Scheme,选择“Run ...”方案然后“Arguments”选项卡添加文件输入(< file.txt)参数将不起作用,至少在 Xcode 4.6 中不起作用.3.

于 2013-09-06T19:16:59.913 回答