📄 para.h
字号:
/*************************************************************************** para.h - description ------------------- begin : Wed Jul 23 2003 copyright : (C) 2003 by Jeremy email : zhiming_z@hotmail.com ***************************************************************************/#ifdef HAVE_CONFIG_H#include <config.h>#endif#include <iostream.h>#include <iomanip.h>#include <stdlib.h>#include <math.h>#include <sys/types.h>#include <stdio.h>#include <sys/stat.h>#include <fcntl.h>#include <string.h>#include <unistd.h>#define NULL 0#define FLEN sizeof (file_node)#define NAME_LENGTH 8#define SEEK_SET 0#define OFF_SET 9728#define BPS 512#define FILE_EMPTY 0#define FILE_DEL 229#define INP_LEN 12 //the length of command or filename that you inpur in your commands/* start of struct and class*/struct file_node{ char file_name[8], ext_name[3]; int readonly,hidden,system,isdir,isfile;/* and ithers*/ int hour,minute,second; int year,month,day; int start_cluster; int file_length; struct file_node *prev, *next,*down; int num_cluster; //there is no such ones in linux ,use this to record the cluster where the direntry is int num_index; //and this to record the index of the file at one cluster(from 0 to 15)};struct super_block{ int sector_p_cluster; //1 in fat12 int num_fat; //2 in fat12 int num_root_dir_entry; //14 in fat12 int num_log_sector; //logic numbers 2880 in fat12 11*256+64 int sector_p_fat; //09 in fat12 int num_hid_sector; // int other_use_sector; //1 in fat12};class perbyte /*use this class to change one unsigned char to 10 and ASCII*/{ public: unsigned char b_input,b_output;unsigned char buf[BPS]; unsigned binary[8]; int l_10,h_10; perbyte(unsigned char temp); ~perbyte();};perbyte::perbyte(unsigned char temp){ unsigned a,b,c,d=15; // d/15 is 0000,1111 in binary unsigned w0=128,w1=64,w2=32,w3=16,w4=8,w5=4,w6=2,w7=1; b_input=(unsigned char)'\0';b_output=(unsigned char)'\0'; b_input=temp; if (((b_input>64)&&(b_input<91))||((b_input>96)&&(b_input<128))) b_output=b_input; else b_output='.'; //the word can't be shown will putout . instead c=b_input; a=c>>4; //move four bits to the right then a is the four bits of the higher one b=c&d; //b is the four bits of the lower one h_10=(int)a; l_10=(int)b; //binary[i] is designed for the attrib byte binary[0]=w0&temp;binary[0]=binary[0]>>7; binary[1]=w1&temp;binary[1]=binary[1]>>6; binary[2]=w2&temp;binary[2]=binary[2]>>5; binary[3]=w3&temp;binary[3]=binary[3]>>4; binary[4]=w4&temp;binary[4]=binary[4]>>3; binary[5]=w5&temp;binary[5]=binary[5]>>2; binary[6]=w6&temp;binary[6]=binary[6]>>1; binary[7]=w7&temp; }perbyte::~perbyte(){//cout<<"you"<<endl;}/* end of struct and class*/struct file_node *head,*cur_head,*head_per_cluster,*p_end;struct super_block sb_fat12;unsigned char buffer[BPS];off_t offset=9728; ///????????int fid;int clu_num,form_clu_num;int log_num,form_log_num;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -