File System Implementation Problem

hi
I have to implement a file system which should have following specifications:
1. Create a new file.
2. List & view existing files.
3. Copy file from windows (*.txt).
4. Copy file to windows (*.txt).
5. Modify.
6. Delete.

At the initialization of file system, a 10 MB file should be initialized. Your file should be divided into 3
parts.

1.First portion (1MB) of your file “File_system” should be reserved for the file names and the
starting address of the data in the file. It should be subdivided into sub blocks, each of capacity
500B. In other words, each sub block in the first block (1 MB) of the file should have a capacity
to store file name and starting address which should not exceed 500B.

2.Second portion (1MB) of your file “File_system” should be reserved for listing the available
empty (vacant) blocks in the third portion.

3.Third portion (8MB) of your file “File_system” should be reserved for the data to be written in
the files listed in first portion of your “File_system”.

I don't know how to start with it.I came up with the following solution.is it right?.Its just a start...

#include <iostream>
#include <string>

struct FileAddr // 1MB sapce-holder to hold file names and adrresses
{
char file_name[492]; // 1 char =1B and it's required that this block should b 500B so 500-8(to stores pointer) =492B
char *addr_of_file; // 8B in x64 machines
FileAddr(){} // costructor initializes file_name with '/0' and char* with NULL
};

struct Block_1KB{
char Block_file[1016];
char *Block_filee;
Block_1KB(){} // initialize wih '/0'
};

struct Main_drive{
FileAddr filenames[2048]; // almost size to 1MB
char *Unallocated_Addr[8064]; // stores almost addrresses of 8064 blocks of 1KB(8MB) and this array size to almost 64KB as pointer is of 8Bytes
Block_1KB txt_files[8064];
Main_drive(){} // initilize char*unallocated_Addr[i]=&txt_file[i]


};


Topic archived. No new replies allowed.