gpt4 book ai didi

c++ - 代码 4 : file as command argument

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:35:01 25 4
gpt4 key购买 nike

如何在 Xcode 4 中将文件作为 C++ 文件的参数?现在,当我运行我的项目时,我必须在终端中使用:

g++ mainFile.cpp -o main.out < inputfile.txt

我希望能够在 XCode 中执行“<inputfile.txt”部分,以便我可以使用调试器等。

在我的代码中,我像这样通过 cin 使用输入文件:

cin>>dim; 

for (int i =0; i<dim; i++) {
for (int j =0; j<dim; j++) {
cin>>A[i][j];
}
}

我正在学习 C++ 初学者类(class),因此代码必须如此。我非常想在 XCode 中运行它!谢谢

最佳答案

阅读 CedricSoubie 对以下 Stack Overflow 问题的回答:

How do you specify command line arguments in Xcode 4?

关于c++ - 代码 4 : file as command argument,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6088333/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com