rendered paste body#include <iostream>
#include <fstream>
using namespace std;
fstream hdd;
void list_dir()
{
if (hdd.is_open())
{
string line;
while (! hdd.eof() )
{
getline (hdd,line);
// cout << line[0];
if(line[0]=='$')
{
string drive_name = "";
drive_name += line[1];
drive_name += ":\\";
// drive_name += '\\';
// cout << drive_name;
cout << line[1] << ":\\" << endl;
// cout << "test " << line[0];
while (line[0]!=')')
{
// cout << "test";
getline(hdd,line);
if(line[0]=='#')
{
string file_name;
int i = 2;
while(line[i]!=']')
{
file_name = file_name + line[i];
i++;
}
cout << drive_name << file_name << endl;
}
}
}
}
cout << "------------------------" << endl << endl;
return;
}
}
int main()
{
cout << "Initializing.." << endl;
hdd.open ("hdd.txt");
if (hdd.is_open())
{
list_dir();
hdd.close();
}
else cout << "Unable to open HDD file.";
}
/*
Example hdd.txt:
$C(
#[example.txt]{ this is an example text}
#[example2.txt]{Another examplefsdd text.}
)
$D(
#[blah.exe]{ blahlbahlbahl }
#[bewm.txt]{ etc }
)
*/