Example:
// CLRConsole.cpp : main project file. #include "stdafx.h" using namespace System; int main(array<System::String ^> ^args) { Console::WriteLine(L"type in something, then press ENTER:"); String^ userInput = Console::ReadLine(); Console::WriteLine("Thanks! you enter: " + userInput); Console::ReadLine(); return 0; }
Please note that the data returned from Console::ReadLine() is in type of String^. It's a handle that reference a String object. To know more about "^", please refer the post ^ (Handle to Object on Managed Heap).
No comments:
Post a Comment