Click here to Skip to main content
16,015,218 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: problem with new operator constructing GDI+ classes Pin
Joel Lucsy6-Mar-03 2:58
Joel Lucsy6-Mar-03 2:58 
GeneralRe: problem with new operator constructing GDI+ classes Pin
Baris Kurtlutepe6-Mar-03 3:47
Baris Kurtlutepe6-Mar-03 3:47 
Generalturn off "are you sure you want to delete?" NonVS question Pin
ns6-Mar-03 1:21
ns6-Mar-03 1:21 
GeneralRe: turn off "are you sure you want to delete?" NonVS question Pin
-Dy6-Mar-03 1:35
-Dy6-Mar-03 1:35 
Generalthanks! Pin
ns6-Mar-03 1:37
ns6-Mar-03 1:37 
GeneralMember functions are "unresolved external symbol" Pin
Rickard Andersson206-Mar-03 0:47
Rickard Andersson206-Mar-03 0:47 
GeneralRe: Member functions are "unresolved external symbol" Pin
Rage6-Mar-03 0:55
professionalRage6-Mar-03 0:55 
GeneralRe: Member functions are "unresolved external symbol" Pin
Rickard Andersson206-Mar-03 2:40
Rickard Andersson206-Mar-03 2:40 
I don't think that is the problem...

This is my .h file:

extern string strDay[7];
extern string strMonth[12];

class CLogBook
{
public:
	CLogBook();
	virtual ~CLogBook();

	BOOL Open(string);
	void Close();

	BOOL FillListBox(HWND);
	virtual BOOL Write(string) = 0;
	BOOL Clear();

protected:
	fstream m_filestream;
};

class CErrorLog : public CLogBook
{
public:
	CErrorLog();
	~CErrorLog();

	BOOL Write(string);
};


And my .cpp:

#include "stdafx.h"

string strDay[7] = {"Söndag", "Måndag",
					"Tisdag", "Onsdag",
					"Torsdag", "Fredag",
					"Lördag"};

string strMonth[12] = {"januari", "februari", "mars",
					   "april", "maj", "juni",
					   "juli", "augusti", "september",
					   "oktober", "november", "december"};

CLogBook::~CLogBook()
{
	Close();
}

BOOL CLogBook::Open(string path)
{
	m_filestream.open(path.c_str(),
					  ios_base::in | ios_base::out | ios_base::app);
	
	if(!m_filestream.is_open())
		return FALSE;

	return TRUE;
}

void CLogBook::Close()
{
	if(!m_filestream.is_open())
		m_filestream.close();
}

BOOL CLogBook::Clear()
{
	if(!m_filestream.is_open())
		return FALSE;

	m_filestream.write("",0);
	return TRUE;
}

BOOL CLogBook::FillListBox(HWND listbox)
{
	if(!m_filestream.is_open())
		return FALSE;

	m_filestream.seekg(0);
	while(!m_filestream.eof())
	{
		string buf("");
		getline(m_filestream, buf, '\n');
		ListBox_AddString(listbox, buf.c_str());
	}
	return TRUE;
}

BOOL CLogBook::Write(string data)
{
	if(!m_filestream.is_open())
		return FALSE;

	m_filestream.write(data.c_str(), (int)data.length());
	return TRUE;
}

///
/// CErrorLog derived class
///

BOOL CErrorLog::Write(string data)
{
	string strDataToWrite("");
	strDataToWrite.append(DateTimeString());
	strDataToWrite.append(" > ");
	strDataToWrite.append(data);

	return CLogBook::Write(strDataToWrite);
}


Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!

UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!

GeneralRe: Member functions are "unresolved external symbol" Pin
Brian Shifrin6-Mar-03 1:39
Brian Shifrin6-Mar-03 1:39 
GeneralRe: Member functions are "unresolved external symbol" Pin
Rickard Andersson206-Mar-03 2:46
Rickard Andersson206-Mar-03 2:46 
GeneralRasEnumEntries please help Pin
Jump_Around6-Mar-03 0:45
Jump_Around6-Mar-03 0:45 
GeneralRe: RasEnumEntries please help Pin
Rickard Andersson206-Mar-03 0:52
Rickard Andersson206-Mar-03 0:52 
GeneralRe: RasEnumEntries please help Pin
João Paulo Figueira6-Mar-03 1:05
professionalJoão Paulo Figueira6-Mar-03 1:05 
GeneralRe: RasEnumEntries please help Pin
Martyn Pearson6-Mar-03 3:07
Martyn Pearson6-Mar-03 3:07 
GeneralRe: RasEnumEntries please help Pin
Jump_Around6-Mar-03 3:10
Jump_Around6-Mar-03 3:10 
GeneralRe: RasEnumEntries please help Pin
Big Art6-Mar-03 8:14
Big Art6-Mar-03 8:14 
GeneralProblems using CFormView Pin
nutkase6-Mar-03 0:37
nutkase6-Mar-03 0:37 
GeneralRe: Problems using CFormView Pin
Hans Ruck6-Mar-03 1:18
Hans Ruck6-Mar-03 1:18 
GeneralRe: Problems using CFormView Pin
nutkase6-Mar-03 1:31
nutkase6-Mar-03 1:31 
QuestionHow to display full column length in SQL Pin
IrishSonic5-Mar-03 23:56
IrishSonic5-Mar-03 23:56 
AnswerRe: How to display full column length in SQL Pin
Alvaro Mendez6-Mar-03 5:31
Alvaro Mendez6-Mar-03 5:31 
GeneralRe: How to display full column length in SQL Pin
IrishSonic6-Mar-03 11:20
IrishSonic6-Mar-03 11:20 
GeneralDll problem, A call to AfxGetResourceHandle() results in Debug Assertion Failure. Pin
Farrukh4u5-Mar-03 23:49
Farrukh4u5-Mar-03 23:49 
GeneralRe: Dll problem, A call to AfxGetResourceHandle() results in Debug Assertion Failure. Pin
Hans Ruck6-Mar-03 0:23
Hans Ruck6-Mar-03 0:23 
GeneralRe: Dll problem, A call to AfxGetResourceHandle() results in Debug Assertion Failure. Pin
Farrukh4u10-Mar-03 23:17
Farrukh4u10-Mar-03 23:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.