Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The squareroot directory squareroot and file allocation table FAT will be needed for problens 1, 2 and 3. squareroot and FAT are tables defined as

image text in transcribedimage text in transcribed

The squareroot directory squareroot and file allocation table FAT will be needed for problens 1, 2 and 3. squareroot and FAT are tables defined as follows. The squareroot table has 6 entries and the FAT has 16 entries. The first colunn of the squareroot is the file nane and the second column indicates the first block of the file. The only colunn of the FAT is the link field which indicates the next block in the file. In the FAT, a 0 indicates the entry is the last block in the file. The first free Block in the free list is given in FAT(theta). The functions Firstblock(F) and Nextblock(F, I) are also members of the FileSys class. Firstblock(F) returns the number of the first block in the file F (returns -1 if the file does not exist and returns 0 if the file has no blocks). Nextblock accepts a file name F and a block number I and returns the block number of the block that follows I in the file F. It returns 0 if I is the last block in the -1 if I does not belong to the file. Use Firstblock, Nextblock, and Delblock to write a function: int clobber(FileSys& filesystem, string file) which accepts a file name "file" and clobbers the file. That is, the function deletes every block in the file leaving the file empty. Note the file remains in the squareroot list, but it has a first block equal to 0. Note that your function may not directly access or modify the FAT or squareroot. It must use Firstblock, Nextblock, and Delblock

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago