C编程作业代写、代写C program 、代写simulated FAT作业、C程序作业代写

You have been asked to write a C program that tests a simulated FAT (File Allocation Table).
Although this program may not be very big, you must use several source files, and a makefile.

There is a maximum of 30 sectors that can be used by the file system, sectors 0 and 1 are special and are used for other purposes. In total there are 32 entries in the FAT.

The FAT is stored in memory as int fat[32], and is stored on disk in the file fat.dat.
The numbers form a chain of sectors, with the last link in each chain being 0. A number of 1 means that the sector is "free".
The following functions are to be written in the source file "fat.c"
void read_fat(void); read the file into memory 32 numbers, one per line. First two numbers are 0.
void save_fat(void); write the current memory contents back to disk, overwriting the previous file.
int free_sectors(void); return the total number of sectors that are currently free.
int first_free_sector(void); return the lowest numbered sector that is currently free.
void allocate_sectors(int start_sector, int n); form a chain n sectors long beginning at start_sector.
void deallocate_sectors(int start_sector); make free the chain starting at start_sector.
void print_sector_chain(int start_sector); print the chain of sectors starting at start_sector

Information about the current files is stored in the directory. There can be up to 30 entries in the directory, which consists of a filename (12 chars or less, no spaces) and an initial sector. In memory it is stored as an array of strings and an array of ints.
On disk the directory is stored in the file dir.dat one entry per line, format: filename start_sector.
The following functions are to be written in the source file "dir.c"
void read_dir(void); read the directory information into memory
void save_dir(void); save the current directory information overwriting the previous file
void print_dir(void); print the current directory, one file per line format: filename start_sector
int does_file_exist_in_dir(char *file); return –1 if the file does not exist, else its position in the directory.
void add_file_to_dir(char *file, int start_sector); add file to memory image of directory
void delete_file_from_dir(int position); delete file from memory image of directory

Your main program in file "assign4.c" repeatedly accepts commands from the user.
The prompt is a single ':'. The commands can be a mixture of:

:sectors filename
:delete filename
:add filename number
:dir
:quit

sectors filename, prints a list of each sector number used by the file filename in the correct order. Either sector numbers are printed with a single space between each on one line, or an error message "File does not exist" is printed.

delete filename, removes the entry from the directory and sets to 1 the FAT entry of each sector associated with this file. The only error message for this command is "File does not exist". The altered directory and FAT are saved to disk.

add filename number, adds the file to the directory and allocates number sectors to it.
The sector numbers are chosen by: start at FAT entry 2, find the first free sector, use this as the initial sector of the file.
Each subsequent sector required by the file is found by continuing to find free sectors sequentially from the first.
The only error message for this command is one of: "File already exists", "Directory is full", and "Not enough free sectors". Check for a full directory before checking for free sectors. The altered directory and FAT are saved to disk.

dir, lists each file in the directory one entry per line format: filename start_sector.

quit, ends the program.

There must be no other output apart from that detailed above.

You have to create all the files, 3 C files (assign4.c, fat.c, dir.c), 1 header file (assign4.h),
2 data files (fat.dat, dir.dat), and 1 makefile (makefile) to control the compilation .
You will only hand in the 3 C files, the header file and the makefile.

As you can only hand in 1 file electronically, before submission, you must combine the five files into one single file, assign4.txt. The format of this text file must be:
assign4.c
.....your assign4.c file.....
fat.c
.....your fat.c file.....
dir.c
.....your dir.c file.....
assign4.h
.....your header file.....
makefile
.....your makefile.....
http://www.daixie0.com/contents/13/1246.html

本团队核心人员组成主要包括硅谷工程师、BAT一线工程师,国内Top5硕士、博士生,精通德英语!我们主要业务范围是代做编程大作业、课程设计等等。

我们的方向领域:window编程 数值算法 AI人工智能 金融统计 计量分析 大数据 网络编程 WEB编程 通讯编程 游戏编程多媒体linux 外挂编程 程序API图像处理 嵌入式/单片机 数据库编程 控制台 进程与线程 网络安全  汇编语言 硬件编程 软件设计 工程标准规等。其中代写代做编程语言或工具包括但不限于以下范围:

C/C++/C#代写

Java代写

IT代写

Python代写

辅导编程作业

Matlab代写

Haskell代写

Processing代写

Linux环境搭建

Rust代写

Data Structure Assginment 数据结构代写

MIPS代写

Machine Learning 作业 代写

Oracle/SQL/PostgreSQL/Pig 数据库代写/代做/辅导

Web开发、网站开发、网站作业

ASP.NET网站开发

Finance Insurace Statistics统计、回归、迭代

Prolog代写

Computer Computational method代做

因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:[email protected]

微信:codinghelp

 

猜你喜欢

转载自www.cnblogs.com/codinghelp168/p/8881942.html