codes to work in .NET Framework

A

Allen Maki

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;

}
 
P

pvdg42

Allen Maki said:
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;

}

OK, here's the same thing in the context of a C++/CLI main() method.

int main(array<System::String ^> ^args)

{


DateTime current = DateTime::Now;

Console::WriteLine(current);

return 0;

}
 
K

Kevin Spencer

Console.WriteLine(DateTime.Now);

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top