Of course, I used "C:\\Windows" in code itself.
list.~QList();
root.~QDir();
To copy to clipboard, switch view to plain text mode
- Do not return the error but it is really error to create such object on stack-
Filewalker odyn (f.size(), f.fileName(), f.path())
Filewalker odyn (f.size(), f.fileName(), f.path())
To copy to clipboard, switch view to plain text mode
- but debugger return segmentation fault on recursion line or
QList <QFileInfo> list
= root.
entryInfoList(QDir::Files|QDir
::Dirs|QDir
::NoDotAndDotDot);
QList <QFileInfo> list = root.entryInfoList(QDir::Files|QDir::Dirs|QDir::NoDotAndDotDot);
To copy to clipboard, switch view to plain text mode
- in last case I cannot put it with new operator or pointers?? or it possible?
Just added (...QDir::NoSymLinks) -- the diplay appeared more restricted - just 2 lines of file properties instead about dozen in previous case.
"Why are you creating multiple instances of FileWalker (with different initializations), when all of the FileWalker methods are static?" - this lines I do not undestand.
Every filewalker for every file properties? "with different initializations" - what you mean under different initialization?
Of course I could use all static methods in anotehr class - f.e. in Lister -- but static variables and methods are some global ones- and are initialized before the object creation.
"You create a FileLister instance on the stack (odyn), then you append it to a Lister's list, and then it goes out of scope when you exit the if() clause." - here maybe I do not understand some c++ fundamentals (sepite I have read most of main C++ and recently Qt books) - "and then it goes out of scope when you exit the if() clause." - did it means that listed is not appended?
This program is some analogue of Java one - that was designed by me and works very well.
It first craete the vector(list, here, as Qvector has no append fuction). Then I could write this properties to file (but converted in xml in advance) or render directly from this list of Filewalker, transformed to xml, and displayed in some kind of Textarea(multiline). And this system should be able to search by file name (by Filewalker name fileds or by XML name field ).
Added after 58 minutes:
When I change to:
QList <Filewalker*> Lister::listed;
....Filewalker* odyn = new Filewalker (f.size(), f.fileName(), f.path());
I got the same result (about dozens of lines with results and filewalker.exe console (memory) crash).
When I add something lower - the destructor
delete odyn - I got even worse result witn about 5 lines of display.
...
Trying to put listed on heap I got
QList* <Filewalker*> Lister::listed=new QList <Filewalker*>(); -- expected constructor, destructor, or type conversion before '*' token. So I am doubted that I can initialize static list with new operator.
Anyway after some changes with new operator - one option brings the SIGSEGF error during debugging
under the line of:
QList <QFileInfo> list = root.entryInfoList(QDir::Files|QDir:irs|QDir::NoDotAndDotDot);
Added after 31 minutes:
Without creating the Filewalker objects(odyn), just using fileinfo instances "f",
cout<<"File:"<<f.size()<<" " << f.fileName()<<" " <<f.path()<<" "<<s<<"\n";
cout<<"File:"<<f.size()<<" " << f.fileName()<<" " <<f.path()<<" "<<s<<"\n";
To copy to clipboard, switch view to plain text mode
I got the same results, and debugger show the recursion line. So in this case the issue is in recursion or
in QFileInfoList list as it probably could not be put at hip as it is using the factory method?
Anyway if just to transform qfileinfo to xml and add to xml file I need to use recursion.
In Java <<File[] list = root.listFiles();>> it is similar but works in memory management and the same recursion.
Without creating the Filewalker objects(odyn), just using fileinfo instances "f",
cout<<"File:"<<f.size()<<" " << f.fileName()<<" " <<f.path()<<" "<<s<<"\n";
cout<<"File:"<<f.size()<<" " << f.fileName()<<" " <<f.path()<<" "<<s<<"\n";
To copy to clipboard, switch view to plain text mode
I got the same results, and debugger show the recursion line. So in this case the issue is in recursion or
in QFileInfoList list as it probably could not be put at hip as it is using the factory method?
Anyway if just to transform qfileinfo to xml and add to xml file I need to use recursion.
In Java <<File[] list = root.listFiles();>> it is similar but works in memory management and the same recursion.
Added after 19 minutes:
Without creating the Filewalker objects(odyn), just using fileinfo instances "f",
cout<<"File:"<<f.size()<<" " << f.fileName()<<" " <<f.path()<<" "<<s<<"\n";
cout<<"File:"<<f.size()<<" " << f.fileName()<<" " <<f.path()<<" "<<s<<"\n";
To copy to clipboard, switch view to plain text mode
I got the same results, and debugger show the recursion line. So in this case the issue is in recursion or
in QFileInfoList list as it probably could not be put at hip as it is using the factory method?
Anyway if just to transform qfileinfo to xml and add to xml file I need to use recursion.
In Java <<File[] list = root.listFiles();>> it is similar but works in memory management and the same recursion.
Bookmarks