在C ++中使用退出功能时,如何暂停命令窗口?

时间:2018-11-09 23:37:24

标签: c++

当用户键入内容时,我希望我的功能停止并显示一个短语。当用户键入特定的内容时,我的程序当前关闭命令窗口,但我希望它暂停以使用户可以看到该短语。下面是我有问题的代码:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\jmarshall\Desktop\ETL\ETLApp\ETLAppEnv_3_7\lib\site-packages\paramiko\client.py", line 437, in connect
    passphrase,
  File "C:\Users\jmarshall\Desktop\ETL\ETLApp\ETLAppEnv_3_7\lib\site-packages\paramiko\client.py", line 749, in _auth
    raise saved_exception
  File "C:\Users\jmarshall\Desktop\ETL\ETLApp\ETLAppEnv_3_7\lib\site-packages\paramiko\client.py", line 736, in _auth
    self._transport.auth_password(username, password)
  File "C:\Users\jmarshall\Desktop\ETL\ETLApp\ETLAppEnv_3_7\lib\site-packages\paramiko\transport.py", line 1436, in auth_password
    return self.auth_handler.wait_for_response(my_event)
  File "C:\Users\jmarshall\Desktop\ETL\ETLApp\ETLAppEnv_3_7\lib\site-packages\paramiko\auth_handler.py", line 250, in wait_for_response
    raise e
paramiko.ssh_exception.AuthenticationException: Authentication failed.
Socket exception: An existing connection was forcibly closed by the remote host (10054)
>>> client.connect(hostname='HOST', username='DOMAIN\administrator', password='myPassword')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\jmarshall\Desktop\ETL\ETLApp\ETLAppEnv_3_7\lib\site-packages\paramiko\client.py", line 437, in connect
    passphrase,
  File "C:\Users\jmarshall\Desktop\ETL\ETLApp\ETLAppEnv_3_7\lib\site-packages\paramiko\client.py", line 749, in _auth
    raise saved_exception
  File "C:\Users\jmarshall\Desktop\ETL\ETLApp\ETLAppEnv_3_7\lib\site-packages\paramiko\client.py", line 736, in _auth
    self._transport.auth_password(username, password)
  File "C:\Users\jmarshall\Desktop\ETL\ETLApp\ETLAppEnv_3_7\lib\site-packages\paramiko\transport.py", line 1436, in auth_password
    return self.auth_handler.wait_for_response(my_event)
  File "C:\Users\jmarshall\Desktop\ETL\ETLApp\ETLAppEnv_3_7\lib\site-packages\paramiko\auth_handler.py", line 250, in wait_for_response
    raise e
paramiko.ssh_exception.AuthenticationException: Authentication failed.

1 个答案:

答案 0 :(得分:2)

通常,实现此目标的一种好方法是:

std::cout << "Press enter to continue" << std::endl;
std::cin.ignore();