Xcode:调试时输入用户输入 [英] Xcode: entering user input when debugging

查看:105
本文介绍了Xcode:调试时输入用户输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

int main()
{
    cout << "Buy or sell (b/s): " << endl;
    string buy_sell;
    cin >> buy_sell;
    .....
}

当我尝试逐步执行此操作时在Xcode中,它在cin >> buy_sell行处停止,因为它正在等待用户输入。如何在调试器中输入值?我正在使用Xcode 3.2.1。

When i try to step through this in Xcode, it stops at the cin >> buy_sell line, because it's waiting for the user input. How do I enter the value in the debugger? I'm using Xcode 3.2.1.

(我知道我可以注释掉cin行并在代码中定义变量以进行调试,但这将非常乏味,我觉得应该是输入我不知道的输入的简便方法。)

(I know I could just comment out the cin lines and define the variable in the code for debugging purposes, but that would be very tedious, and I feel like there should be an easy way to enter input that I just don't know about.)

推荐答案

您是否正在使用XCode控制台?您可以在调试器下方的运行菜单下访问它。快捷方式是 command-shift-R 。从那里您可以像在终端上一样与应用程序进行交互,但是可以从XCode本身内部进行。

Are you using the XCode console? You can access it under the "Run" menu, just below the Debugger. The shortcut is command-shift-R. From there you can interact with the application exactly like a terminal, but from inside of XCode itself.

这篇关于Xcode:调试时输入用户输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆