> It looks like you are creating a root for every block. This is not a good idea. You need one root for the entire tree. In your example the root should be for E:\.
But I've got this line:
...
Type: Posts; User: kawafis44
> It looks like you are creating a root for every block. This is not a good idea. You need one root for the entire tree. In your example the root should be for E:\.
But I've got this line:
...
This is example of input file (but program should support some different language versions and different versions of dir/s command dependent on version of Windows):
Wolumin w stacji E nie ma...
I changed this code a little. Now question one is answered - I won't be using integer number to indicate directories but lineInFile to indicate line of input file where I've got information about...
I've got still some problems.
It is my actual code:
/*
Program of navigating the directory tree, displaying subdirectories and
files in current directory. The program uses output of the dir/s...
About my second question:
I think I have done it. I used:
sub1.children.push_back(sub11);
And now I use:
sub1->children.push_back(sub11);
This is code about using tree structure:
int...
Thanks!
I've got two other questions - they are written inside the code.
Thanks in advance :)
/*
Program of navigating the directory tree, displaying subdirectories and
files in current...
About pushing back subdirectories:
I know that root is an object and sub1, sub11, ..., sub311 are pointers. I create object root and I add sub1, sub2, sub3 to children vector of root by pushing them...
Thanks!
My new code:
#include <iostream>
#include <vector>
#include <fstream>
using namespace std;
class Directory
OK, so I'll follow #1 and maybe after finishing the whole project I will try to change it with using #2. Is it the proper way? (I've got a problem with destructing these children)
#include...
Thanks! Which of these solutions will be the best for storing directories? I want to read directories from file which is created in this way "dir /s > myfile.txt" and creating process will be...
I heard that using exceptions is if I've got situation which shouldn't happen and probably won't happen at all - this is why we call it exception. I don't use 'if' because I guess it will never...
I've got this code (it is only part of my code):
int main(void) {
ifstream fin("myfile.txt");
string line;
int counter=0;
string nameMainDir; //it contains line " Directory:...
Thanks! Now I've got two questions:
1) how can I create copying constructor (and do I really need it? - line print(root); couldn't be compiled so I thought it may be caused by the lack of copying...
OK, now I've got the other idea and the other code. But I don't know 1) where I've got memory outflow (what kind of situation can cause this memory outflow), 2) how to avoid it/ improve the code...
This is what I've got - main and then dir1, dir2 on the same level. I saved a copy of iter to parent after creating "main" and before "dir1". But I guess there is a problem with "output the dir tree"...
//typedef tree<dir> treeDir;
tree<dir> leafDir; //it creates tree of dir
//I need two variables
//"One to hold the current parent, and the other to save the result of insert".
//Is...
Sorry for the stupid question but how to do it (how to write the proper code)? I was trying to do it and I don't know how. Thanks for help :).
It is my code but based on the code from that site (the link is given in my first post).
I changed this listing from previous message - now there is also possibility to see the results of creating...
Hello! It is my first post and I've got probably easy question. I can use containers like list, vector. But I think there is no tree container in standard containers of C++. I found this site...