⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 output.cpp

📁 Debug.x:封装SEH 作用:在程序发生未处理的异常时
💻 CPP
字号:
// Output.cpp: implementation of the COutput class.
// Defined by Wei Shufng. email: _cout@163.com
// Compiled with VC++6.0, Windows XP Professional V2002.
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Output.h"
#include <assert.h>
#include <fstream.h>
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

COutput::COutput()
{
	memset (m_strFile, 0x00, sizeof (m_strFile));
	GetCurrentDirectory (sizeof (m_strFile), m_strFile);
	strcat (m_strFile, "\\Output.txt");
}

COutput::~COutput()
{

}
COutput::COutput (char *pch)
{
	assert (pch != NULL);
	strcpy (m_strFile, pch);
	m_strFile[sizeof (m_strFile) - 1] = NULL;
}

void COutput::SetFileName (LPCSTR pch)
{
	assert (pch != NULL);
	strcpy (m_strFile, pch);
	m_strFile[sizeof (m_strFile) - 1] = NULL;
}

char *COutput::GetFileName ()
{
	return m_strFile;
}
void COutput::WriteString (LPCSTR pstr)
{
	assert (pstr != NULL);
	ofstream of;
	try {
		of.open (m_strFile, ios::app | ios::in | ios::out);
		of.write (pstr, strlen (pstr));
		of.close ();
	}
	catch (...) {
		of.close ();
	}
}

void COutput::NewLine ()
{
	ofstream of;
	try {
		of.open (m_strFile, ios::app | ios::in | ios::out);
		of << endl;
		of.close ();
	}
	catch (...) {
		of.close ();
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -