Click to See Complete Forum and Search --> : CLR console application


Programmer127
January 2nd, 2007, 06:03 PM
I am new to vc++. When I first create a CLR console application, the source code looks like this:
------------------------------------------------------------------------------------------------
#include "stdafx.h"
using namespace System;
int main(array<System::String ^> ^args)
{
Console::WriteLine(L"Hello World");
return 0;
}
------------------------------------------------------------------------------------------------
I have a few questions about this.

First, in the line Console::WriteLine(L"Hello World");
what does the "L" do?

Secondly, if I wanted to read a line of input from the screen into a system::string, how would I do so?

If anyone can point me toward any basic information about programming a CLR Console Application, that would be great.

Thanks in advance!!

Ejaz
January 3rd, 2007, 01:14 AM
[ Moved Thread ]

Zaccheus
January 3rd, 2007, 07:36 AM
what does the "L" do?
The L tells the compiler to create a 16bit unicode string rather than an 8bit ansi string.

Secondly, if I wanted to read a line of input from the screen into a system::string, how would I do so?

If anyone can point me toward any basic information about programming a CLR Console Application, that would be great.

MSDN - Console class (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemconsoleclasstopic.asp) : "By default, the value of the In (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemConsolePropertiesTopic.asp) property is a System.IO.TextReader"

Programmer127
January 3rd, 2007, 08:42 PM
That was very helpful. Thanks!!