#include "stdafx.h"
#include "Time.h"
#using <mscorlib.dll>
using namespace System;
using namespace System::IO;
Time::Time (String* pthv, String* dtv)
{
path = pthv;
data = dtv;
}
Time::Time (String* pthv )
{
path = pthv;
}
Time::Time ( String* pthv, Char dgv )
{
path = pthv;
digit = dgv;
}
void Time::WriteFile ()
{
FileStream* fs = new FileStream(path, FileMode::OpenOrCreate);
StreamWriter* sw = new StreamWriter(fs); // Create a StreamWriter
sw->Write(data);
sw->Flush();
sw->Close();
}
void Time::WriteFileApnd()
{
FileStream* fs = new FileStream(path, FileMode::Append); // Show the
time and that the signing is"in" (minus sign)
StreamWriter* sw = new StreamWriter(fs);
sw->WriteLine(data); //b
sw->Flush();
sw->Close();
}
Char Time::RedFile()
{
FileStream* fs = new FileStream(path, FileMode::Open);// Check to see
that the last signing
StreamReader* sr = new StreamReader(fs); // was "in" to avoid
signing "in" twice
digit = sr->Read();
return digit;
}
/***************************************************************************/
*.h
using namespace System; //Is very important to be put in this header file,
Otherwise you will get eror C2143 and C2501
//static Char mark;
__gc class Time
{
private:
String* path;
String* data;
Char digit;
public:
Time (String* path, String* data);
Time (String* path);
Time (String* pthv, Char dgv);
void WriteFile ();
void WriteFileApnd();
Char RedFile();
--
Thanks
Allen
> This declaration of class is a part of a program. This program will
> build, but will have compiler error.
> [...]
Sorry, but this newsgroup is Italian only.
You may post your question to an English C++ newsgroup.
In particular, considering that your code seems to me C++/CLI code, you
may use microsoft.public.dotnet.languages.vc newsgroup (which is about
C++/CLI).
HTH,
Giovanni