code with c++ 2008

i'm new here,,can you give me a sample program that save the date and the time of the system on a text file when i press a bouton "ok" (i have an application windows form) thanks for help!!
yeah I can
yeah I can


Ha ha ha....

i'm new here,,can you give me a sample program that save the date and the time of the system on a text file when i press a bouton "ok" (i have an application windows form) thanks for help!!


Just so ya know if you want help your going to have to give what code you already have.

And use code tags...

closed account (z05DSL3A)
the EventHandler for the button would look something like:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
private: System::Void ok_button_Click(System::Object^  sender, System::EventArgs^  e) 
             {
                 DateTime this_day =  DateTime::Now;

                 String^ path = "c:\\temp\\MyTest.txt";

                 StreamWriter^ sw;
                 if ( !File::Exists( path ) )
                 {
                     sw = File::CreateText( path );
                 }
                 else
                 {
                     sw = File::AppendText( path );
                 }
                 try
                 {
                     sw->WriteLine( this_day );
                 }
                 finally
                 {
                     if ( sw )
                         delete (IDisposable^)sw;
                 }
             }
NB: Code is C++/CLI
Topic archived. No new replies allowed.