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

📄 iokit.cpp

📁 The ROSETTA C++ library is a collection of C++ classes and routines that enable discernibility-based
💻 CPP
字号:
//-------------------------------------------------------------------// Author........: Aleksander 豩rn// Date..........:// Description...:// Revisions.....://===================================================================#include <stdafx.h> // Precompiled headers.#include <copyright.h>#include <kernel/utilities/iokit.h>#include <kernel/utilities/delimiter.h>#include <kernel/system/fstream.h>#include <kernel/basic/string.h>//-------------------------------------------------------------------// Static stuff.//===================================================================unsigned int  IOKit::buffersize_ = 10240;char         *IOKit::buffer_     = NULL;//-------------------------------------------------------------------// Methods for class IOKit.//===================================================================//-------------------------------------------------------------------// Method........: AllocateBuffer// Author........: Aleksander 豩rn// Date..........:// Description...:// Comments......: More optimal reuse of allocated buffer is possible.// Revisions.....://===================================================================boolIOKit::AllocateBuffer(unsigned int buffersize) {	// Reuse current buffer?	if ((buffer_ != NULL) && (buffersize == buffersize_))		return true;	buffersize_ = buffersize;	// Deallocate current buffer?	if (buffer_ != NULL)		delete [] buffer_;	// Allocate new buffer.	buffer_ = new char[buffersize_];	return (buffer_ != NULL);}//-------------------------------------------------------------------// Method........: Open// Author........: Aleksander 豩rn// Date..........:// Description...:// Comments......:// Revisions.....://===================================================================boolIOKit::Open(ifstream &stream, const String &filename) {	stream.open(filename.GetBuffer(), ios::in | ios::nocreate);	return (1 == stream.is_open());}//-------------------------------------------------------------------// Method........: Open// Author........: Aleksander 豩rn// Date..........:// Description...:// Comments......:// Revisions.....://===================================================================boolIOKit::Open(ofstream &stream, const String &filename, bool append) {	if (!append)		stream.open(filename.GetBuffer());	else		stream.open(filename.GetBuffer(), ios::out | ios::app);	return (1 == stream.is_open());}//-------------------------------------------------------------------// Method........: Close// Author........: Aleksander 豩rn// Date..........:// Description...:// Comments......:// Revisions.....://===================================================================boolIOKit::Close(ifstream &stream) {	stream.close();	return true;}//-------------------------------------------------------------------// Method........: Close// Author........: Aleksander 豩rn// Date..........:// Description...:// Comments......:// Revisions.....://===================================================================boolIOKit::Close(ofstream &stream) {	stream.close();	return true;}//-------------------------------------------------------------------// Method........: Save// Author........: Aleksander 豩rn// Date..........:// Description...:// Comments......:// Revisions.....: 970511 A

⌨️ 快捷键说明

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