i want to write a c++ code that due the structure of file space allocation,Simulates file system with 2*n array.Each column represents a sector,The first row is for storing files And second row holds the address of the next sector (Number of columns).and With each click on keyboard Create a file with random size and automatically find Appropriate sectors by using disk allocation method (or index allocation)...Also File names should be asked from user...and we should have file table Where the starting address of each sector,file extention and file size is given..

Ok ... post the code you have so far ... and where you think you are having a problem.

Edited 2 Years Ago by David W: added comments

thanks For your attention...almost nothing...All I know is basics of c++ and all i have is definition ...i don't know how to code for create random size of file

The coding problem that you seem to be posing is not a 'beginner type' problem, I would say ... So you should be able to post some code ... other wise ... the problem needs to be put off until you have some more coding skills.

And ... the coding spec's you give are not well defined ... Is your problem to simulate file storage ... but to use RAM and an array as the storage unit to access RAM?

Edited 2 Years Ago by David W: changed punctuation

What David_W said. This is not a beginner problem. First, you need to understand something of file system structures. Next, you need to understand how to relate that to program code. Other than re-iterating your class assignment, you haven't done anything that lets us think you understand the scope of the problem, or any approaches that may be fruitful in solving the problem.

One good approach (to give you a hint) is using an extent-based file system. IE, a file consists of one or more extents - locations on the disc where parts of the file exists. The first part of each extent is a header that indicates the size of the current extent, and the disc sector where the next extent is to be found.

This article has been dead for over six months. Start a new discussion instead.