积极答复者
CLR Console application

问题
-
CLR控制台文件调试输出一闪而过
每次建立一个C++的CLR控制台应用程序,可是按Ctrl+F5运行的时候总是一闪而过,根本看不到东西而在C++的普通控制台程序里是可以看一个黑屏和相应操作的,提示按任意键继续
When I build a c++ CLR Console application, press CTRL + F5 to debug, the window runs quickly, I can not see anything. But in c++ console program, I can look at a black screen and the corresponding operation, the prompt press any key to continue
答案
-
C++的控制台程序在调试运行状态下(F5)也是看不到任意键继续的,只能在非调试运行状态下(CTRL+F5)看见,而且你在explorer双击打开也是看不见的。如果你非要看见的话,可以这么写:
Console.ReadKey();
- 已标记为答案 Min-Hong Tang - MSFT 2010年8月25日 8:01
全部回复
-
断点如何设置?我按Ctrl+B,然后函数里填main,行数写24,但没反应啊
#include "stdafx.h"
using namespace System;
int main(array<System::String ^> ^args)
{
wchar_t letter; //Corresponds to the c++/ClI char type
Console::Write(L"Enter a letter:");
letter = Console::Read();
if (letter>='A')
if(letter<='Z')
{
Console::WriteLine(L"You entered a capital letter.");
return 0;
}
if(letter>='a')
if(letter<='z')
{Console::WriteLine(L"You entered a small letter.");
return 0;
}
Console::WriteLine(L"You did not enter a letter.");
return 0;
} -
C++的控制台程序在调试运行状态下(F5)也是看不到任意键继续的,只能在非调试运行状态下(CTRL+F5)看见,而且你在explorer双击打开也是看不见的。如果你非要看见的话,可以这么写:
Console.ReadKey();
- 已标记为答案 Min-Hong Tang - MSFT 2010年8月25日 8:01