?? main.cpp
字號(hào):
#include <fstream.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
struct operation
{
int time; //起始時(shí)間
int block; //內(nèi)存頁(yè)數(shù)
int oper; //操作
int protection; //權(quán)限
};
int main()
{
FILE * file;
file = fopen("opfile", "wb"); //"opfile"為二進(jìn)制用確定內(nèi)存操作
operation op;
for(int j = 0; j < 6; j++)
{
for(int i = 0; i <5; i++)
{
//0-PAGE_READONLY;
//1-PAGE_READWRITE;
//2-PAGE_EXECUTE;
//3-PAGE_ECECUTE_READ;
//4-PAGE_EXECUTE_READWRITE;
op.time = rand() % 1000; //隨即生成等待時(shí)間
op.block = rand() % 5 + 1; //隨即生成塊大小
op.oper = j;
op.protection = i;
fwrite(&op, sizeof( operation), 1, file); //將生成的結(jié)構(gòu)寫(xiě)入文件
}
}
return 0;
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -