|
can u please format your message by selecting "Ignore HTML tags in this message" check box, because of it no other messages can be viewed in the page
|
|
|
|
|
I'm trying to obtain the filelist for a directory tree.
A way is to redirect a dir command to a file and to read that file.
How can this be done in VC++ 6?
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
Instead of redirecting the output of a dir command, you can do the same thing directly in your program using FindFirstFile() [^] and FindNextFile() [^]. These are Windows API functions that you can use from VC6.
|
|
|
|
|
Actually, is not what I'm looking for. I need a function that is listing ALL the structure, including what the subfolders amd sub-subfolders, ..., and so on ... do contain. To avoid recursively use of findfirst , findfnext pair and to obtain all the list into a single step.
Is there anything like this in VC++6 ?
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
RomTibi wrote: Actually, is not what I'm looking for.
Yes, it is. Gary's suggestion still applies whether you want one level or multiple levels.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
You can use of DlgDirList for get list of files and folders but for subfolders you need to a loop and use of these functions.
|
|
|
|
|
SAdly ... I have to work ...
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
you can ask if you have any problem.
|
|
|
|
|
i understand that the use of the friend keyword allows you to get around access specifiers but im a little confused as to why, or when you would want to do this as opposed to just adding it as a regular function.
|
|
|
|
|
friend is useful when you build a set of classes that really work together but make more sense to keep as individual classes for organizational reasons. Some of the functionality they use between them should be non-public. Friend helps achieve that.
Purists discourage the use of friend. However, that philosophy can lead to huge monolithic classes or exposed public methods that really shouldn't be used by everyone.
I found it to be useful but I agree with some that it should be used sparingly.
|
|
|
|
|
Thanks, i think i understand what your saying.
|
|
|
|
|
I do not want to size the combobox depending
on it's content-length, but to use the available space of the toolbar
containing it, for its' width (like the address-combo in the IE).
But the source you wrote might be useful in another place...
wqewqqeweqwrwerewrwe
|
|
|
|
|
ftbk wrote: But the source you wrote might be useful in another place...
This makes me think you're trying to reply to a specific person with a new post. That doesn't work
'please help me' is certainly polite, but it's not helpful, everyone here wants help.
What happens if you set the size of the combo box after adding the items, does it still resize itself ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hello everyone,
I am confused to read what the compiler says. Could anyone explain what it means?
#include <memory>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main( )
{
int i = 0;
vector<auto_ptr<int>> vc;
for (i = 0; i < 5; i ++)
{
auto_ptr<int> pi (new int(i));
vc.push_back (pi);
}
return 0;
}
1>Compiling...
1>main.cpp
1>d:\program files\microsoft visual studio 9.0\vc\include\vector(1209) : error C2558: class 'std::auto_ptr<_Ty>' : no copy constructor available or copy constructor is declared 'explicit'
1> with
1> [
1> _Ty=int
1> ]
1> d:\program files\microsoft visual studio 9.0\vc\include\vector(1158) : while compiling class template member function 'void std::vector<_Ty>::_Insert_n(std::_Vector_const_iterator<_Ty,_Alloc>,unsigned int,const _Ty &)'
1> with
1> [
1> _Ty=std::auto_ptr<int>,
1> _Alloc=std::allocator<std::auto_ptr<int>>
1> ]
1> d:\visual studio 2008\projects\test_autoptr1\test_autoptr1\main.cpp(11) : see reference to class template instantiation 'std::vector<_Ty>' being compiled
1> with
1> [
1> _Ty=std::auto_ptr<int>
1> ]
1>d:\program files\microsoft visual studio 9.0\vc\include\vector(1233) : error C2558: class 'std::auto_ptr<_Ty>' : no copy constructor available or copy constructor is declared 'explicit'
1> with
1> [
1> _Ty=int
1> ]
thanks in advance,
George
|
|
|
|
|
You can't use auto_ptr in a vector. As the errors imply, it was not designed to support the copy semantics necessary for vector to work.
But who is the king of all of these folks?
|
|
|
|
|
Thanks Shog9,
My question is more about how to get information from compile error message. In the compile error message, it is indicated copy constructor could not be found. Actualy in auto_ptr copy constructor is implemented, but the required one (with const reference as input) is not provided. And this one (with const reference as input) is the one which vector push_back is looking.
How to get information from compile error message to find which copy constructor is missing?
regards,
George
|
|
|
|
|
George_George wrote: How to get information from compile error message to find which copy constructor is missing?
Unfortunately, sometimes you just have to resort to doing a bit of spelunking to figure out exactly what's wrong.
But who is the king of all of these folks?
|
|
|
|
|
Thanks Shog9,
When clicking on the line of following compile error message,
1>d:\program files\microsoft visual studio 9.0\vc\include\vector(1209) : error C2558: class 'std::auto_ptr<_Ty>' : no copy constructor available or copy constructor is declared 'explicit'
1> with
1> [
1> _Ty=int
1> ]
It jumps to the following statement in file vector,
else if ((size_type)(_Mylast - _VEC_ITER_BASE(_Where)) < _Count)
{
_Ty _Tmp = _Val;
_Umove(_VEC_ITER_BASE(_Where), _Mylast,
_VEC_ITER_BASE(_Where) + _Count);
If you met with the issues, how do you analyze down? Share some ideas then I could do the detailed work to make my hands dirty?
regards,
George
|
|
|
|
|
The line in question is a simple assignment. _Tmp is a new local being initialized with _Val which, if you read up, is a parameter of type const _Ty& . So, in order for this to compile, _Ty will need to implement a copy constructor which accepts a const _Ty& . A quick examination of the definition for auto_ptr reveals that it does not.
But who is the king of all of these folks?
|
|
|
|
|
Cool, Shog9!
My question is answered.
regards,
George
|
|
|
|
|
Actually, the line "_Ty _Tmp = _Val;" is most definitely NOT an assignment statement. It is a initialization statement, and the two are very different. See, for example,
http://publib.boulder.ibm.com/infocenter/cellcomp/v101v121/index.jsp?topic=/com.ibm.xlcpp101.cell.doc/language_ref/cplr387.html[^]
or
http://msdn.microsoft.com/en-us/library/0yw5843c(VS.71).aspx[^]
and Stroustrup's comments on the difference between initialization and assignment. And while std::vector does require the _Ty to be assignable, this is not one of the places where that requirement would seem to be important. In particular, I can make _Ty assignable (with an assignment operator), and provide a copy-constructor, but if I make the copy constructor explicit, the line "_Ty _Tmp = _Val;" will fail, but the line "_Ty _Tmp(_Val);" would not fail. I can see no reason why "_Ty _Tmp(_Val);" would not be acceptable in std::vector, in both the insert and the assign methods. With "_Ty _Tmp = _Val;", I cannot use vectors on classes that have explicit copy constructors, even when they have assignment operators. Is there a good reason for this?
|
|
|
|
|
What I mean is the following line in file vector
_Ty _Tmp = _Val;
I can not edit it in the post.
regards,
George
|
|
|
|
|
|
|
What Shog said
There's nothing else regular you could do, trying to understand the code, checking the declarations, etc. Sometimes it helps to move it to a separate, minimalist project. - But what of these works best for you in a particular situation, noone can tell.
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP blog: TDD - the Aha! | Linkify!| FoldWithUs! | sighist
|
|
|
|