本文整理汇总了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();
}