Write a single file system code in C++ to implement all of the following functio
ID: 3813856 • Letter: W
Question
Write a single file system code in C++ to implement all of the following functions
In this part of the project, you will have to implement your File System in C/C++, which would provide following API functions: Function Description CSC322 fopen CSC322FILE CSC322 fopen(const char "filename, const char "mode) Functionality and parameter list like infopen function. MSDN http:/Imsdn microsoft.com/en-usLibrary/yeby3zcb.aspx Instead of pointer to FILE, your function should return pointer to CSC322FILE a RAM structure which you designed in Part 2 for the management of a file. CSC322FILE should be used in all other functions instead of FILE when relevant File names supported: character string 1 to 64 character long Only "rb", "wb", "w+b", ab" should be supported CSC322 fclose int CSC322 fclose (CSC322FILE stream This function should perform cleanup appropriate to the elaborated solution. Functionality and parameter list like infolosel function. MSDN http msdn mi bra CSC322 fread int CSC322 fread(void buffer, size t nBytes, csc322FILE stream); Functionality and parameter list like infread function. MSDN msdn microsoft.com/en-usMibrarlktoetdcs aspx SCS322 fwrite int CSC322 fwrite (void "buffer, size t nBytes, CSC322FILE stream): Functionality and parameter list similar fwrite function. MSDN msdn microsoft. en Library 9t88zw2.aspx csc322 fseek int CSC322 fseek(csc322FILE stream, long offset, int origin) Functionality and parameter list like in fseek function. MSDN msdn microsoft.c en bra LE aspx. CSC322 ftell long CSC322 ftell (CSC322FILE "stream); Functionality and parameter list like in ftell function. MSDN n.microsoft.c en-usMibra aspxExplanation / Answer
#include <iostream>
#include <fstream>
using namespace std;
void openinfile(ifstream &infile)
{
char filename[100];
cout<<"Enter the file name: ";
cin>>filename;
infile.open(filename);
}
void main(void)
{
ifstream inputfile;
ofstream outputfile;
char chs;
openinfile(inputfile);
outputfile.open("C:\samplewrite.txt");
while (!inputfile.eof())
{
inputfile.get(chs);
if (!inputfile.eof())
{
cout<<chs;
outputfile<<chs;
}
}
cout<<" Reading and writing file is completed!"<<endl;
inputfile.close();
outputfile.close();
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.