i have the following problem::
i have ofstream object (i call it fout) belonging to a class{it a field of that class}, where should i initialize it...
i write the following test-code but it gives me strange compile errors{in visual studio05}
FoutTest.h
#pragma once
#include <fstream>
#include <string>
class CFoutTest
{
public: CFoutTest(string filename="test.dat");
public: ~CFoutTest(void);
public:
ofstream fout;
void print(string text);
};
FoutTest.cpp
#include "FoutTest.h"
CFoutTest::CFoutTest(string filename)
:fout(filename.c_str())
{
//fout(filename.c_str(), ios_base::app| ios_base::out | ios_base:text)
}
CFoutTest::~CFoutTest(void)
{
}
CFoutTest::print(string text)
{
fout<<text;
}
main.cpp
#include "FoutTest.h"
int main()
{
CFoutTest test;
test.print("dokimi");
}
plz help me find the error!!
thanks in advance,
N.A.