Probelm with std::vector in function

Hi I have code:
1
2
3
4
5
6
7
8
void Searchfile()
{
HANDLE hFile;
WIN32_FIND_DATA wfd;
std::vector<HANDLE> handles(100); // <- this is shutdown line

...
}


If I add only this the program shutdown. Why??
Complie is ok.
In one case I have runtime error.
closed account (S6k9GNh0)
Try making a test case. That will probably find your answer.

http://en.wikipedia.org/wiki/Test_case

Also, for kicks, how do you know that's the "shutdown" line?
Last edited on
I find two declaration of handle, maybe it is a problem:
1
2
3
4
typedef void HANDLE

#define HANDLE void *


I changed to std::vector<void *> handles(100); and everything is ok

Anybody can explain me this??
I get another issue:

I have
1
2
3
4
5
6
7
8
9
10
11
12
13
struct HandleStructure{
HANDLE hHandle;
};
...
void Searchfile()
{
HandleStructure strHandle;
std::vector<HandleStructure> handles(100);

strHandle.hHandle = FindFirstFile(L"*.*", &wfd);
handles.push_back(strHandle); //<-CRASH PROGRAM
...
}


Anybody help?! PLEASE!!
Last edited on
Topic archived. No new replies allowed.