confmgr.cpp

来自「Linux下的C、C++ IDE」· C++ 代码 · 共 115 行

CPP
115
字号
/*   FILE: confmgr.cppPROJECT: hide AUTHOR: James MartinCREATED: 9/15/2002*/#include "confmgr.h"//#include "portdef.h"#include <cstring>#include <fstream>//#include <cstdlib>///////////////////// EditorConfMgrbool EditorConfMgr::save(){	std::ofstream out(m_path);	if (!out)		return false;	out << "FONTSIZE=" << m_FontSize << "\n";	out.close();	return true;}bool EditorConfMgr::load(){	char line[1024], *p = NULL;	std::ifstream in(m_path);		if (!in)		return false;	in.getline(line, sizeof(line));	while (!in.eof())	{		if (strstr(line, "FONTSIZE="))		{			strtok(line, "=");						if ((p = strtok(NULL, "\n")))				m_FontSize = p;		}		in.getline(line, sizeof(line)); 	}	in.close();	return true;}///////////////////// GlobalConfMgrbool GlobalConfMgr::save(){	std::ofstream out(m_path);	if (!out)		return false;	out << "OPENLASTPROJ=" << m_bOpenLastProj << "\n";	out << "LASTPROJ=" << m_LastProj << "\n";	out.close();	return true;}bool GlobalConfMgr::load(){	char line[1024], *p = NULL;	std::ifstream in(m_path);		if (!in)		return false;	in.getline(line, sizeof(line));	while (!in.eof())	{		if (strstr(line, "OPENLASTPROJ="))		{			strtok(line, "=");						if ((p = strtok(NULL, "\n")))				m_bOpenLastProj = atoi(p);		}		else		if (strstr(line, "LASTPROJ="))		{			strtok(line, "=");						if ((p = strtok(NULL, "\n")))				m_LastProj = p;		}		in.getline(line, sizeof(line)); 	}	in.close();	return true;}

⌨️ 快捷键说明

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