当前位置: 首页>>代码示例>>C++>>正文


C++ Disk::writeLine方法代码示例

本文整理汇总了C++中Disk::writeLine方法的典型用法代码示例。如果您正苦于以下问题:C++ Disk::writeLine方法的具体用法?C++ Disk::writeLine怎么用?C++ Disk::writeLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Disk的用法示例。


在下文中一共展示了Disk::writeLine方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: moveToDisk

void LongScheduler::moveToDisk()
{
	ofstream longSchedLog_Disk;
	longSchedLog_Disk.open("longSchedLog-Disk.txt", fstream::out);
	
		//check PCB for terminated processes
	for(int i = 1; i<=30; i++)
	{

	longSchedLog_Disk << "PID: " << i << endl;
	longSchedLog_Disk << "Amount of free space in RAM: " << ram.howManyFreeBytes() << endl;

		//if process is terminated, continue to remove process information from RAM
		if(pcb_table.getStatus(i) == TERMINATED)
		{
			longSchedLog_Disk << "Terminated PID: " << i << endl;

			//remove process from RAM int Disk
			for(int j = 0; j < (pcb_table.getCodeSize(i) + 44); j++)
			{ 
				int ram_line_number = pcb_table.getCodeStartRamAddress(i) + j;
				int disk_line_number = pcb_table.getCodeDiskAddress(i)+j;
				disk1.writeLine(ram.readCharLine(ram_line_number),	disk_line_number);

				longSchedLog_Disk << "Process Sucessfully written to Disk" << endl;

			}
		}

		terminated_queue.pop();
		longSchedLog_Disk << "Process Successfully removed from terminated queue." << endl;


		//reallocate space in RAM for removed process
		//Troy can you write a function to allow for me to pass the current process number 
		//and the function will allocate the appropriate amount of space into RAM

		longSchedLog_Disk << "Amount of free space in RAM: " << ram.howManyFreeBytes() << endl << endl;
	}

	longSchedLog_Disk.close();
}
开发者ID:wpegg-dev,项目名称:College-Work,代码行数:42,代码来源:long-term_scheduler.cpp


注:本文中的Disk::writeLine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。