all groups > dotnet clr > april 2007 >
You're in the

dotnet clr

group:

print the current time on the screen



print the current time on the screen Allen Maki
4/15/2007 3:07:21 PM
dotnet clr: Hi everybody,



I need help.



I want to print the current time on the screen. After research I managed to
run the codes below in regular C++. But I could not make it to run in .NET
Framework environment. Can anybody tell me how to make these codes to work
in .NET Framework or show me an alternative codes?



/*

the author said that you have to turn on debug multi-threading to make this
program works

*/



#include <afx.h>

#include <iostream>

using namespace std;



int main()

{

CTime now = CTime::GetCurrentTime();

CString str = now.Format(" %H:%M:%S - ");

cout << str << endl;



return 0;

}

Re: print the current time on the screen Mattias Sjögren
4/16/2007 12:00:00 AM
[quoted text, click to view]

System.DateTime.Now will return the current time, and
System.Console.WriteLine will let you print it.


Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
AddThis Social Bookmark Button