P
Peter Mrosek
Hello,
I have the following declaration in an header file (abbreviated
version):
[...]
typedef struct {
unsigned char rgbBlue;
unsigned char rgbGreen;
unsigned char rgbRed;
unsigned char rgbReserved;
}RGBQUAD;
[...]
vector<RGBQUAD> colsToGetDist;
[...]
and this is a line from my main program:
[...]
colsToGetDist.resize(n);
[...]
The problem ist, that I get segmentation faults in this line.
The faults vanish when I add the line
colsToGetDist.resize(1);
to the constructor, but I don't understand why resize seems to fail
allocating memory.
Are there some circumstances in which resize does't work?
Maybe someone here can help.
Peter
I have the following declaration in an header file (abbreviated
version):
[...]
typedef struct {
unsigned char rgbBlue;
unsigned char rgbGreen;
unsigned char rgbRed;
unsigned char rgbReserved;
}RGBQUAD;
[...]
vector<RGBQUAD> colsToGetDist;
[...]
and this is a line from my main program:
[...]
colsToGetDist.resize(n);
[...]
The problem ist, that I get segmentation faults in this line.
The faults vanish when I add the line
colsToGetDist.resize(1);
to the constructor, but I don't understand why resize seems to fail
allocating memory.
Are there some circumstances in which resize does't work?
Maybe someone here can help.
Peter